海康采集卡RegisterStreamDirectReadCallback回调函数在VB中的应用
海康视频采集卡
VC:回调声明:
DLLEXPORT_API int __stdcall RegisterStreamDirectReadCallback(STREAM_DIRECT_READ_CALLBACK StreamDirectReadCallback,void *Context);
VC:回调定义:
int __cdecl StreamDirectReadCallback(ULONG channelNumber,void *DataBuf,DWORD Length,int FrameType,void *context);
VC:回调实现:
int __cdecl StreamDirectReadCallback(ULONG channelNum,void *DataBuf,DWORD Length,int frameType,void *context)
{
return 0;
}
VC:回调调用:
RegisterStreamDirectReadCallback(::StreamDirectReadCallback,this);
要将以上代码在VB中实现,请问如何来做!!
我的做写法如下,不过报错:DLL约定错误::!!!
VB回调声明:
Public Declare Function RegisterStreamDirectReadCallback Lib "DS40xxSDK.dll" (ByVal StreamDirectReadCallback As Any, ByVal context As Long)
VB回调实现:
Function StreamDirectReadCallback(ByVal channelNum As Long, ByRef DataBuf As Variant, ByVal Length As Long, ByVal frameType As Integer, ByVal context As Long) As Long
StreamDirectReadCallback = 0&
End Function
VB回调调用:
Call RegisterStreamDirectReadCallback(AddressOf StreamDirectReadCallback,Me.hDC)
请高人指点一下!!!!