
BOBOT
The following works with windows7 x64 w/VB6, LogitechC90 USB VideoCam
Make sure the Video Camera is installed: double check it using EZB.
START A VB6 project
ADD 4 buttons and rename them: cmdCapture, cmdClose, cmdExit, cmdVideoFormat
ADD a picturebox: picture1
Select from MENU.PROJECT.ADDMODULE (this creates and adds a .bas file to the project)
ADD the following code to the .bas module file that you just created.
Then ADD the code for the 4 buttons.
Public Const ws_child As Long = &H40000000
Public Const ws_visible As Long = &H10000000
Global Const WM_USER = 1024
Global Const wm_cap_driver_connect = WM_USER + 10
Global Const wm_cap_set_preview = WM_USER + 50
Global Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52
Global Const WM_CAP_DRIVER_DISCONNECT As Long = WM_USER + 11
Public Const WM_CAP_DLG_VIDEOFORMAT As Long = WM_USER + 41
Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
Declare Function capCreateCaptureWindow Lib "avicap32.dll" Alias "capCreateCaptureWindowA" (ByVal a As String, ByVal b As Long, ByVal c As Integer, ByVal d As Integer, ByVal e As Integer, ByVal f As Integer, ByVal g As Long, ByVal h As Integer) As Long
Private Sub cmdCapture_Click()
Dim temp As Long
hwdc = capCreateCaptureWindow("", ws_child Or ws_visible, 0, 0, 320, 240, Picture1.hWnd, 0)
If (hwdc 0) Then
temp = SendMessage(hwdc, wm_cap_driver_connect, 0, 0)
temp = SendMessage(hwdc, wm_cap_set_preview, 1, 0)
temp = SendMessage(hwdc, WM_CAP_SET_PREVIEWRATE, 30, 0)
startcap = True
Else
MsgBox ("No Webcam found")
End If
End Sub
Private Sub cmdClose_Click()
Dim temp As Long
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DRIVER_DISCONNECT, 0&, 0&)
startcap = False
End If
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdVideoFormat_Click()
Dim temp As Long
If startcap = True Then
temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
End If
End Sub
http://www.ez-robot.com/Community/Forum/posts.aspx?threadId=2768
Enjoy!
Yep, I did but I can't get it to run in Visual Basic 2012. Keep getting errors....But , I'll keep working on it..
Also, I get the bluetooth cam to work from ezbuiler but in the above VB6 app, If I select the wireless cam I just get a black picture box. Any ideas?
EZ-Bobot
It won't load...a bunch of error messages.
Anyways, I'll keep working on it and post any findings I get running.