vb子程序或函数未定义
Dim hwdc As Long
Dim startcap As Boolean
Private Type Bitmap
bmType As Long
bmWidth As Long
bmHeight As Long
bmWidthBytes As Long
bmPlanes As Integer
bmBitsPixel As Integer
bmBits As Long
End Type
Dim Pbytes() As Byte, Pinfo As Bitmap
Dim x As Long, y As Long
Private Sub Form_Load()
If App.PrevInstance = Ture Then End
Picture1.AutoSize = Ture
Picture2.AutoSize = True
Picture1.ScaleMode = vbPixels
Picture2.ScaleMode = vbPixels
Timer1.Interval = 10
hwdc = capCreateCaptureWindow("Webcam Vision System", WS_CHILD Or WS_VISIBLE, 0, 0, 160, 120, Picture1.hwnd, 0)/运行到这里总是显示子程序或者函数未定义
If (hwdc <> 0) Then
Clipboard.Clear
If SendMessage(hwdc, WM_CAP_DRIVER_CONNECT, 0, 0) Then
SendMessage hwdc, WM_CAP_SET_SCALE, 1, 0
SendMessage hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0
SendMessage hwdc, WM_CAP_SET_PREVIEW, 1, 0
SetWindowPos hwdc, HWND_BOTTOM, 0, 0, 160, 120, SWP_NOMOVE Or SWP_NOZORDER
SendMessage hwdc, WM_CAP_GET_FRAME, 0, 0
SendMessage hwdc, WM_CAP_COPY, 0, 0
Picture1.Picture = Clipboard.GetData
GetObject Pictureq.Picture, Len(Pinfo), Pinfo
ReDim Pbytes(0 To (Pinfo.bmBitsPixel \ 8) - 1, 0 To Pinfo.bmWidth - 1, 0 To Pinfo.bmHeight - 1)
Picture2.height = Picture1.height
Picture2.width = Picture1.width
Timer1.Enabled = True
startcap = True
Else
MagBox "'No Webcam found!"",OK."
startcap = False
Unload Me
End If
Else