Const WS_CHILD = &H40000000
Const WS_VISIBLE = &H10000000
Const WM_CAP_START = &H400
Const WM_CAP_STOP = WM_CAP_START + 68
Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
......
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (lpszWindowName As String, dwStyle As Long, x As Integer, y As Integer, nWidth As Integer, nHeight As Integer, ParentWin As Long, nID As Integer) As Long
......Private Sub Command1_Click()
hWndC = capCreateCaptureWindowA("windows", WS_VISIBLE + WS_CHILD, Frame1.Left, Frame1.Top, Frame1.Width, Frame1.Height, Form1.hwnd, 0)
If hWndC > 0 Then
.....
endif
End Sub为什么 hWndC 的值为0
Const WS_VISIBLE = &H10000000
Const WM_CAP_START = &H400
Const WM_CAP_STOP = WM_CAP_START + 68
Const WM_CAP_DRIVER_CONNECT = WM_CAP_START + 10
Const WM_CAP_DRIVER_DISCONNECT = WM_CAP_START + 11
......
Private Declare Function SendMessage& Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any)
Private Declare Function capCreateCaptureWindowA Lib "avicap32.dll" (lpszWindowName As String, dwStyle As Long, x As Integer, y As Integer, nWidth As Integer, nHeight As Integer, ParentWin As Long, nID As Integer) As Long
......Private Sub Command1_Click()
hWndC = capCreateCaptureWindowA("windows", WS_VISIBLE + WS_CHILD, Frame1.Left, Frame1.Top, Frame1.Width, Frame1.Height, Form1.hwnd, 0)
If hWndC > 0 Then
.....
endif
End Sub为什么 hWndC 的值为0
hWndC = capCreateCaptureWindowA("windows", WS_VISIBLE + WS_CHILD, Frame1.Left, Frame1.Top, Frame1.Width, Frame1.Height, Form1.hwnd, 0)修改成:
hWndC = capCreateCaptureWindowA(byval "windows", WS_VISIBLE + WS_CHILD, Frame1.Left, Frame1.Top, Frame1.Width, Frame1.Height, Form1.hwnd, 0)
ByVal lpszWindowName As String, _
ByVal dwStyle As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As Long, _
ByVal nID As Long) As Long
参考:http://www.xtremevbtalk.com/archive/index.php/t-252268.html