海康采集卡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)
请高人指点一下!!!!
[解决办法]
高人指点一下了,
Call RegisterStreamDirectReadCallback(AddressOf StreamDirectReadCallback,Me.hDC)
这个函数的参数如何写!!???
VB能得到一个窗体的地址吗!!?就好C++中的指针一样!!
比如在一个窗体类中C++用this 指针,那VB中用什么呢!!
[解决办法]
模块:
Option Explicit
Public Declare Function WriteProcessMemory Lib "kernel32" (ByVal hProcess As Long, lpBaseAddress As Any, lpBuffer As Any, ByVal nSize As Long, lpNumberOfBytesWritten As Long) As Long
Public Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Public Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpdwProcessId As Long) As Long
Public Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As Long, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long
Public Declare Function CloseHandle Lib "kernel32" (ByVal hObject As Long) As Long
Public Declare Function ReadProcessMemory Lib "kernel32.dll" (ByVal hProcess As Long, ByVal lpBaseAddress As Long, ByRef lpBuffer As Any, ByVal nSize As Long, ByRef lpNumberOfBytesWritten As Long) As Long
Public Const PROCESS_ALL_ACCESS = &H1F0FFF
窗体:
Private Sub Command1_Click()
Dim h As Long
hProcess = OpenProcess(PROCESS_ALL_ACCESS, False, pid)
If hProcess Then
ReadProcessMemory hProcess, ByVal &H14F2CEC, h, 4, 0&'读取地址14F2CEC的值
CloseHandle hProcess
End If
Text1.Text = h'将读到的值显示在Text1
End SubEnd Sub
[解决办法]
忘记了,要加上这个
Private Sub Form_Load()
hwd = FindWindow(vbNullString, "game")'game是你游戏的进程
GetWindowThreadProcessId hwd, pid hProcess = OpenProcess(PROCESS_ALL_ACCESS, 0, pid)
End Sub
[解决办法]
技术老师们你们好,小生现在想利用VB做一个视频显示软件,不知道用什么控制?
我的目的是想装两个摄像头在电脑上,当然在电脑上要装上采集卡了,然后利用VB做一个小软件,可以同时显示两个摄像头里的内容,然后按一下"确定"时,把当前的两个图片写进数据库!请问有没有相关的VB资料呀,用什么采集卡好呢?怎么编呀?在这里谢谢了!