Handling various Webcam connected to a USB Hub using VB6

Posted on 2006-05-11
Last Modified: 2013-12-26

I'm trying take snapshots with three webcams using a USB Hub in a USB port. I need to know how can I do this, because  I'm using a USB hub and I know that the USB bandwith is divided, So I will have to take a snapshot by camera sequentialy, but I need to know how access the different USB ports of the USB hub and take snapshot.  Regards  
Question by:tarkust

    Author Comment

    I will do a cheap security system usign webcam, so I need at least four cams and process the pictures.  Any code for VB6 will help very much...
    LVL 17

    Expert Comment

    This VB project (68kB) lets you see which USB devices are currently plugged into the USB port :
    LVL 17

    Accepted Solution

    needs :
    1 Form
    1 ezvidcap1 (download:
    3 buttons (to select the video devices)

    Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Integer, ByVal lParam As Long) As Long
    Const WM_CAP_START = &H400
    Dim myVideoWindowHWND As Long
    Public Function UseVideoSource(ByVal hwnd As Long, ByVal myDeviceNumber As Integer) As Boolean
    UseVideoSource = SendMessage(hwnd, WM_CAP_DRIVER_CONNECT, myDeviceNumber, 0)
    End Function

    Private Sub Command1_Click()
       UseVideoSource myVideoWindowHWND, 0 '1st video device
       ezVidCap1.Preview = True
    End Sub

    Private Sub Command2_Click()
       UseVideoSource myVideoWindowHWND, 1 '2nd video device
       ezVidCap1.Preview = True
    End Sub

    Private Sub Command3_Click()
       UseVideoSource myVideoWindowHWND, 2 '3rd video device
       ezVidCap1.Preview = True
    End Sub

    Private Sub Form_Load()
        Command1.Caption = "device1"
        Command2.Caption = "device2"
        Command3.Caption = "device3"
        myVideoWindowHWND = ezVidCap1.hwnd
    End Sub

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction This article makes the case for using two modules in your VBA/VB6 applications to provide both case-sensitive and case-insensitive text comparison operations.  Recently, I solved an EE question using the LIKE function.  In order for th…
    I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
    Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
    Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

    760 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    10 Experts available now in Live!

    Get 1:1 Help Now