How to get USB ports connected to multiple cameras using C/C++ program?

This is a discussion on How to get USB ports connected to multiple cameras using C/C++ program? within the Tech Board forums, part of the Community Boards category; >>When running the following program, it takes the same picture from the same camera.<< Does it report a different device ...

  1. #16
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >>When running the following program, it takes the same picture from the same camera.<<

    Does it report a different device name and id each time? You could try a DoEvents/Sleep in the loop.

    Also, try calling CommonDialog1.ShowSelectDevice to make sure each camera is supported.

    >> how can I adjust its brightness. <<

    I'd suggest breaking it up a bit and looking around.

    Code:
    Set oDevice = DeviceManager1.DeviceInfos(i).Connect
    
    ' See what properties the device supports...
    CommonDialog1.ShowDeviceProperties(oDevice)
    
    Set oItem = oDevice.ExecuteCommand(wiaCommandTakePicture)
    
    ' See what properties the image supports...
    CommonDialog1.ShowItemProperties(oItem)
    
    Set oImage = oItem.Transfer
    ' or Set oImage = CommonDialog1.ShowTransfer(oItem)
    Both the device and the item support a properties collection so have a look around. the oItem represents the picture on the camera before it is downloaded to the computer. Have a look at the other methods on CommonDialog.

  2. #17
    Registered User
    Join Date
    Nov 2003
    Posts
    12
    >>Does it report a different device name and id each time?

    Yes, it reports ids:
    Code:
    {...}\000; 
    {....}\007(I don't know why it is 007, probably according to the USB port. By the way, I have 8 USB ports on my computer);
    {....}\002
    Also, I can see the lights on the the three receivers flashed from red to green. So I am sure it functions from different channel.

    Oh, I got a tricky problem now. When last time channel 1 cam is used in the webcam own software, the picture will be taken differently at the first two pictures. However, when last time channel 2 or 3 is used, the three pictures will be the same.


    >>You could try a DoEvents/Sleep in the loop.
    How can I write such a loop? Could you give me details?

    Also, try calling CommonDialog1.ShowSelectDevice to make sure each camera is supported.

    >>I'd suggest breaking it up a bit and looking around.
    I will try your code.

    Thank you so much

    David

  3. #18
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >>How can I write such a loop? Could you give me details?<<

    Try adding this in the loop.

    Code:
    ' At top of module
    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
    
    ...
    
    DoEvents
    Sleep(1000) ' one second
    DoEvents
    EDIT: I'm signing off for now.
    Last edited by anonytmouse; 12-05-2003 at 11:29 AM.

  4. #19
    Registered User
    Join Date
    Nov 2003
    Posts
    12
    I tried showing device properties, but all are not available, however, except one can't take picture properly, the other two take pictures correctly.

    I will try the sleep next monday. I am not going to work more this week.

    Thanks

    David

Page 2 of 2 FirstFirst 12
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multiple Ports using Sockets
    By mmondok in forum C Programming
    Replies: 1
    Last Post: 04-14-2003, 10:36 PM
  2. Multiple Windows, One Program?
    By skyruler54 in forum C++ Programming
    Replies: 3
    Last Post: 10-12-2002, 09:29 PM
  3. multiple runs of a program
    By unregistered in forum Linux Programming
    Replies: 5
    Last Post: 03-15-2002, 07:18 AM
  4. Disabling multiple instances of a program
    By xds4lx in forum Windows Programming
    Replies: 6
    Last Post: 03-06-2002, 02:21 AM
  5. program that uses multiple funtions
    By mike in forum C++ Programming
    Replies: 5
    Last Post: 02-09-2002, 08:44 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21