We need you!

We're working hard on the next version of Developer Fusion. Let us know what you think we should be up to!

Members

Technology Zones

Articles

Hosted By

MaximumASP

Info

Rated
Read 55,685 times

Downloads

Related Categories

Capture Video

alexreg

This program shows how to capture live video from a web cam and display it in a picture box.

Option Explicit

Const ws_visible = &H10000000
Const ws_child = &H40000000
Const WM_USER = 1024
Const WM_CAP_EDIT_COPY = WM_USER + 30
Const wm_cap_driver_connect = WM_USER + 10
Const wm_cap_set_preview = WM_USER + 50
Const wm_cap_set_overlay = WM_USER + 51
Const WM_CAP_SET_PREVIEWRATE = WM_USER + 52
Const WM_CAP_SEQUENCE = WM_USER + 62
Const WM_CAP_SINGLE_FRAME_OPEN = WM_USER + 70
Const WM_CAP_SINGLE_FRAME_CLOSE = WM_USER + 71
Const WM_CAP_SINGLE_FRAME = WM_USER + 72
Const DRV_USER = &H4000
Const DVM_DIALOG = DRV_USER + 100
Const PREVIEWRATE = 30

Private 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
Private 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 hwndc As Long
Dim saveflag As Integer
Dim pictureindex As Integer
Dim filter1(-1 To 1, -1 To 1) As Single
Dim filter2(-1 To 1, -1 To 1) As Single
Dim temp As String

Private Sub Command2_Click()
   Unload Me
End Sub

Private Sub Form_Load()
On Error GoTo handler:
   hwndc = capCreateCaptureWindow("CaptureWindow", ws_child Or ws_visible, 0, 0, PichWnd.Width, PichWnd.Height, PichWnd.hWnd, 0)
   If (hwndc <> 0) Then
       temp = SendMessage(hwndc, wm_cap_driver_connect, 0, 0)
       temp = SendMessage(hwndc, wm_cap_set_preview, 1, 0)
       temp = SendMessage(hwndc, WM_CAP_SET_PREVIEWRATE, PREVIEWRATE, 0)

       temp = SendMessage(Me.hWnd, WM_CAP_EDIT_COPY, 1, 0)
       Picture1.Picture = Clipboard.GetData
   Else
       MsgBox "Unable to capture video.", vbCritical
   End If
Exit Sub
handler:
End
End Sub

Currently programs in VB, QBasic, ASP, PHP, SQL, HTML, CSS, VBScript and some Java/JavaScript. Learning VB.NET.

Comments

  • Re: [1988] Capture Video

    Posted by easytec on 02 Sep 2007

    So, dating back to 1988 (or so I assumed), VB.NET does allow these features but in Windows Vista and VB.NET (to VC#.NET interpreter language), I don't know why people are asking th...

  • Re: [1988] Capture Video

    Posted by Onel on 11 Jul 2007

    Hello,


    How do i open the dialogue box for cameras or scanner? and how can i open and view .tif image  with VB codes.


    Hope i can find the answers.

  • Posted by dopacio on 03 Aug 2005

    [quote][1]Posted by [b]Wajid[/b] on 27 Jul 2005 09:13 AM[/1]
    Hi,
    I want to view live video from my home pc and web cam is installed in my office. So what should i do for? How can i view live video...

  • How to use web cam in web page to view live video?

    Posted by Wajid on 27 Jul 2005

    Hi,
    I want to view live video from my home pc and web cam is installed in my office. So what should i do for? How can i view live video from a remote location?

    Thanks and regards,
    Wajid

  • Video Capture in vb.net or C#

    Posted by mjnarasu on 25 Jun 2005

    Hi..

    I also want to know about video capturing using vb.net or in C#.


    Thanks and Regards
    Arasu.M