WEBCAM RECORD VIDEO VB6

Post your questions regarding programming in Visual Basic 6 in here.
3 posts Page 1 of 1
Contributors
User avatar
dioxden08
Just Registered
Just Registered
Posts: 2
Joined: Tue Jan 12, 2010 9:39 am

WEBCAM RECORD VIDEO VB6
dioxden08
hello guys! i need to know it badly aSAP. hope someone can help me. thanks a lot!
i cannot record a video on vb6. i saw the tutorials for vb studio but it wasnt running on my vb6.
User avatar
singhkartik
Just Registered
Just Registered
Posts: 2
Joined: Mon Mar 22, 2010 4:36 pm

Re: WEBCAM RECORD VIDEO VB6
singhkartik
@dioxden::
hey did u get any code for the same...actually i too m working on a similar project wherein i have to activate a webcam and record videos or capture images using a code in vb6
User avatar
mikethedj4
VIP - Site Partner
VIP - Site Partner
Posts: 2592
Joined: Thu Mar 25, 2010 4:36 am

Re: WEBCAM RECORD VIDEO VB6
mikethedj4
Here you guys go.
Code: Select all
Global Const ws_child As Long = &H40000000
Global 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
Global 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


 

Dim hwdc As Long
Dim startcap As Boolean
Private Sub cmdCapture_Click()
Dim temp As Long

  hwdc = capCreateCaptureWindow("Dixanta Vision System", 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 cmdVideoFormat_Click()
 Dim temp As Long
 If startcap = True Then
  temp = SendMessage(hwdc, WM_CAP_DLG_VIDEOFORMAT, 0&, 0&)
End If
End Sub
3 posts Page 1 of 1
Return to “General coding help”