char*outPath, int & outLen 参数怎么声明

美薇 2017-03-09 09:44:52

['int WINAPI ftGetSnapedImagePath(int channel, char*outPath, int & outLen);
C# 例程是这样声明的:
[DllImport("FTDetectUCamera.dll", CallingConvention = CallingConvention.StdCall, EntryPoint = "ftGetSnapedImagePath")]
public static extern int ftGetSnapedImagePath(int channel, byte [] outPath, ref int outLen);

我把它改成下面VB这样声明不知是否正确
Private Declare Function ftGetSnapedImagePath Lib "FTDetectUCamera.dll" (ByVal chn As Long, ByRef outPath() As Byte, ByRef outLen As Long)
Dim ret As Long
Dim camIndex As Long

Dim outPath(255) As Byte
Dim outLen As Long
Dim imgPath As String
ret = ftGetSnapedImagePath(camIndex, outPath, outLen)

'运行老是错误,新手上路请指教
...全文
4428 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
舉杯邀明月 2017-03-10
  • 打赏
  • 举报
回复
我觉得应该是赵老虎那样的声明可以用。
美薇 2017-03-10
  • 打赏
  • 举报
回复
不停地翻资料,谢了!
Tiger_Zhao 2017-03-10
  • 打赏
  • 举报
回复
Private Declare Function ftGetSnapedImagePath Lib "FTDetectUCamera.dll" ( _
ByVal chn As Long, _
ByRef outPath As Byte, _
ByRef outLen As Long _
) As Long

Dim ret As Long
Dim camIndex As Long
Dim outPath(255) As Byte
Dim outLen As Long
Dim imgPath As String
ret = ftGetSnapedImagePath(camIndex, outPath(0), outLen)
美薇 2017-03-09
  • 打赏
  • 举报
回复
C# 例程这样使用的: byte[] outPath = new Byte[256]; int outLen = 0; int ret = ftGetSnapedImagePath(camIndex, outPath, ref outLen); C++例程这样用: char temp[256]; int len=0; memset(temp, 0, 256); ftGetSnapedImagePath(camIndex, temp, len); 改成VB后就出错了

1,486

社区成员

发帖
与我相关
我的任务
社区描述
VB API
社区管理员
  • API
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧