'// Connect the capture window to the driver
capDriverConnect lwndC, 0
'// Get the capabilities of the capture driver
capDriverGetCaps lwndC, VarPtr(Caps), Len(Caps)
'// If the capture driver does not support a dialog, grey it out
'// in the menu bar.
If Caps.fHasDlgVideoSource = 0 Then mnuSource.Enabled = False
If Caps.fHasDlgVideoFormat = 0 Then mnuFormat.Enabled = False
If Caps.fHasDlgVideoDisplay = 0 Then mnuDisplay.Enabled = False
'// Set the video stream callback function
capSetCallbackOnVideoStream lwndC, AddressOf MyVideoStreamCallback
capSetCallbackOnFrame lwndC, AddressOf MyFrameCallback
'// Set the preview rate in milliseconds
capPreviewRate lwndC, 66
'// Start previewing the image from the camera
capPreview lwndC, True
'// Resize the capture window to show the whole image
ResizeCaptureWindow lwndC
Private Sub mnuCompression_Click()
' /*
' * Display the Compression dialog when "Compression" is selected from
' * the menu bar.
' */
capDlgVideoCompression lwndC
End Sub
Private Sub mnuDisplay_Click()
' /*
' * Display the Video Display dialog when "Display" is selected from
' * the menu bar.
' */
capDlgVideoDisplay lwndC
End Sub
Private Sub mnuExit_Click()
Unload Me
End Sub
Private Sub mnuFormat_Click()
' /*
' * Display the Video Format dialog when "Format" is selected from the
' * menu bar.
' */
capDlgVideoFormat lwndC
ResizeCaptureWindow lwndC
End Sub
Private Sub mnuPreview_Click()
mnuPreview.Checked = Not (mnuPreview.Checked)
capPreview lwndC, mnuPreview.Checked
End Sub
Private Sub mnuSource_Click()
' /*
' * Display the Video Source dialog when "Source" is selected from the
' * menu bar.
' */
capDlgVideoSource lwndC
End Sub
Private Sub mnuStart_Click()
' /*
' * If Start is selected from the menu, start Streaming capture.
' * The streaming capture is terminated when the Escape key is pressed
' */
lNFrames = 0
capCaptureSequenceNoFile lwndC
End Sub
'---------------------------------------Module1
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Const WM_SYSCOMMAND = &H112
Public Const SC_MOVE = &HF010&
Public Const WM_ACTIVATE = &H6
Public Const WM_KILLFOCUS = &H8
Public Const GWL_WNDPROC = (-4)
Public Const WM_PAINT = &HF
Public Const WM_MBUTTONDOWN = &H207
Public Const WM_SETFOCUS = &H7
Public Declare Function ReleaseCapture Lib "user32" () As Long
Public Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Public Declare Function SelectObject Lib "gdi32" (ByVal hdc As Long, ByVal hObject As Long) As Long
Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcA" (ByVal lpPrevWndFunc As Long, ByVal hwnd As Long, ByVal msg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Public Wndproc As Long
Function Proc(ByVal hwnd As Long, ByVal msg As Long, ByVal wp As Long, ByVal lp As Long) _
As Long
If msg = &H7 Then Proc = 1: Exit Function
Proc = CallWindowProc(Wndproc, hwnd, msg, wp, lp)
End Function