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

解决方案 »

  1.   

    hWndC 的值为0说明capCreateCaptureWindowA调用失败
      

  2.   

    把:
    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)
      

  3.   

    rainstormmaster  api的声明应该没有错的,照你的还是不行
      

  4.   

    Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" ( _
    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
      

  5.   

    射像头的图象窗口吗?尝试用DX接口吧,那里面是GUI吗,不行,不懂,不会.