Private Sub Form_Load()
DimlpszName As String * 100
Dim lpszVer As String * 100
Dim Caps As CAPDRIVERCAPS
Dim ssxtName As String * 100
'//Create Capture Window
capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100 '// Retrieves driver info
lwndC = capCreateCaptureWindowA(lpszName, WS_VISIBLE Or WS_CHILD, 0, 0,1600, 1200, Me.hWnd, 0)
'lwndC = capCreateCaptureWindowA(ssxtName, WS_CAPTION Or WS_THICKFRAMEOr WS_VISIBLE Or WS_CHILD, 0, 0, 1600, 1200, Me.hWnd, 0)
'// Set title of window to name of driver 超声
ssxtName = "" ' "超声实时显示界面"
SetWindowText lwndC, ssxtName
'SetWindowText lwndC, lpszName
'// Set the video stream callback function
capSetCallbackOnStatus lwndC, AddressOf MyStatusCallback
capSetCallbackOnError lwndC, AddressOf MyErrorCallback
'// Connect the capture window to the driver
If capDriverConnect(lwndC, 0) Then
'/////
'// Only do the following if the connect was successful.
'// if it fails, the error will be reported in the call
'// back function.
'/////
'// 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
'// Turn Scale on
capPreviewScale lwndC, True
'// 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
End If
'Rtime.Top = 3500
'Rtime.Left = 5000
'Rtime.Height = 8000
' Rtime.Width = 9700
End Sub
Private Sub Form_Resize()
' Rtime.Height = 5850
' Rtime.Width = 6950
End Sub
Private Sub Form_Unload(Cancel As Integer) 卸载,终止程序。
'// Disable all callbacks
capSetCallbackOnError lwndC, vbNull
capSetCallbackOnStatus lwndC, vbNull
capSetCallbackOnYield lwndC, vbNull
capSetCallbackOnFrame lwndC, vbNull
capSetCallbackOnVideoStream lwndC, vbNull
capSetCallbackOnWaveStream lwndC, vbNull
capSetCallbackOnCapControl lwndC, vbNull
MDIForm1.SPDX.Enabled = True
MDIForm1.SPDX1.Enabled = True
MDIForm1.SPDX2.Enabled = True
End Sub
DimlpszName As String * 100
Dim lpszVer As String * 100
Dim Caps As CAPDRIVERCAPS
Dim ssxtName As String * 100
'//Create Capture Window
capGetDriverDescriptionA 0, lpszName, 100, lpszVer, 100 '// Retrieves driver info
lwndC = capCreateCaptureWindowA(lpszName, WS_VISIBLE Or WS_CHILD, 0, 0,1600, 1200, Me.hWnd, 0)
'lwndC = capCreateCaptureWindowA(ssxtName, WS_CAPTION Or WS_THICKFRAMEOr WS_VISIBLE Or WS_CHILD, 0, 0, 1600, 1200, Me.hWnd, 0)
'// Set title of window to name of driver 超声
ssxtName = "" ' "超声实时显示界面"
SetWindowText lwndC, ssxtName
'SetWindowText lwndC, lpszName
'// Set the video stream callback function
capSetCallbackOnStatus lwndC, AddressOf MyStatusCallback
capSetCallbackOnError lwndC, AddressOf MyErrorCallback
'// Connect the capture window to the driver
If capDriverConnect(lwndC, 0) Then
'/////
'// Only do the following if the connect was successful.
'// if it fails, the error will be reported in the call
'// back function.
'/////
'// 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
'// Turn Scale on
capPreviewScale lwndC, True
'// 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
End If
'Rtime.Top = 3500
'Rtime.Left = 5000
'Rtime.Height = 8000
' Rtime.Width = 9700
End Sub
Private Sub Form_Resize()
' Rtime.Height = 5850
' Rtime.Width = 6950
End Sub
Private Sub Form_Unload(Cancel As Integer) 卸载,终止程序。
'// Disable all callbacks
capSetCallbackOnError lwndC, vbNull
capSetCallbackOnStatus lwndC, vbNull
capSetCallbackOnYield lwndC, vbNull
capSetCallbackOnFrame lwndC, vbNull
capSetCallbackOnVideoStream lwndC, vbNull
capSetCallbackOnWaveStream lwndC, vbNull
capSetCallbackOnCapControl lwndC, vbNull
MDIForm1.SPDX.Enabled = True
MDIForm1.SPDX1.Enabled = True
MDIForm1.SPDX2.Enabled = True
End Sub