Results 1 to 5 of 5

Thread: Selecting USB Camera at start application

  1. #1
    Join Date
    Apr 2012
    Posts
    5

    Selecting USB Camera at start application

    I'm developing a VB.net application, using 2 usb cameras. I created one form with its own IcImagingControl for each camera.
    I'm able to select a camera for each IcImagingControl and display it, but when I save the select device it uses the CurrentProcessName, which is always the same for the application. Next time I startup the application it would try to use the last camera selected instead assigning one camera to each IcImagingcontrol.
    Thank you

  2. #2
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,203

    Re: Selecting USB Camera at start application

    Hi,

    how do you save the devices? And how do you load them at program start?
    Best regards
    Stefan
    IC Imaging Control Support

  3. #3
    Join Date
    Apr 2012
    Posts
    5

    Re: Selecting USB Camera at start application

    Please see my response to your 2 questions below. Thanks

    Here is the code I use to save the device:

    Sub SaveSelectedDevice(ByVal IC15Control As TIS.Imaging.ICImagingControl)
    On Error GoTo err_SaveSelectedDevice
    With IC15Control
    If .DeviceValid Then
    SaveSetting(CurrentProcessName(), REG_SECTION, REG_KEY_VIDEO_SOURCE, .Device)
    If .InputChannelAvailable Then
    SaveSetting(CurrentProcessName(), REG_SECTION, REG_KEY_INPUT_CHANNEL, .InputChannel)
    End If
    If .VideoNormAvailable Then
    SaveSetting(CurrentProcessName(), REG_SECTION, REG_KEY_VIDEO_NORM, .VideoNorm)
    End If

    SaveSetting(CurrentProcessName(), REG_SECTION, REG_KEY_VIDEO_FORMAT, .VideoFormat)

    If .DeviceFrameRateAvailable Then
    SaveSetting(CurrentProcessName(), REG_SECTION, REG_KEY_FRAME_RATE, CStr(.DeviceFrameRate))
    End If

    End If
    End With
    err_SaveSelectedDevice:
    End Sub


    Here is my code to load a device when I load a form call video:

    Private Sub frmVideo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.Width = 665
    Me.Height = 552
    Me.Top = 53

    VideoDeviceSettings1.OpenSelectedDevice(IcImagingC ontrol1)
    IcImagingControl1.LiveStart()
    CrossHairVisible = True

    End Sub

    Here is my code to load a device when I load a form call Witness:

    Private Sub frmWitness_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
    Me.Width = 665
    Me.Height = 552
    Me.Top = 53

    VideoDeviceSettings2.OpenSelectedDevice(IcImagingC ontrol2)
    IcImagingControl2.LiveStart()
    CrossHairVisible = True


    End Sub

  4. #4
    Join Date
    Jan 2003
    Location
    Bremen, Germany
    Posts
    4,203

    Re: Selecting USB Camera at start application

    Hi

    I have a little trouble understanding your problem. If you use CurrentProcessName and have two cameras using this, then the second saving of cameras will always overwrite the first, because CurrentProcessName returns every time the same. It seems CurrentProcessName returns the name of the process, but not of the form. It seems you want to use the name of of the form for this. This can be done either by reflection stuff, or much more simple, you pass a name string to SaveSelectedDevice() and use this instead of CurrentProcessName

    Code:
    Sub SaveSelectedDevice(ByVal IC15Control As TIS.Imaging.ICImagingControl, Name as String)
        ...
        SaveSetting(Name), REG_SECTION, REG_KEY_VIDEO_SOURCE, .Device)
        ....
    
    End Sub
    
    Private Sub frmVideo_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Width = 665
        Me.Height = 552
        Me.Top = 53
    
        VideoDeviceSettings1.SaveSelectedDevice(IcImagingC ontrol1,"Video") ' for saving
    
    
        VideoDeviceSettings1.OpenSelectedDevice(IcImagingC ontrol1,"Video")
        IcImagingControl1.LiveStart()
        CrossHairVisible = True
    
    End Sub
    
    
    Private Sub frmWitness_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Me.Width = 665
        Me.Height = 552
        Me.Top = 53
    
        VideoDeviceSettings1.SaveSelectedDevice(IcImagingC ontrol1,"Witness") ' for saving
    
        VideoDeviceSettings2.OpenSelectedDevice(IcImagingC ontrol2, "Witness")
        IcImagingControl2.LiveStart()
        CrossHairVisible = True
    
    End Sub
    I hope, this sample code shows the idea.
    Best regards
    Stefan
    IC Imaging Control Support

  5. #5
    Join Date
    Apr 2012
    Posts
    5

    Re: Selecting USB Camera at start application

    It works. Thank you very much

Similar Threads

  1. Application unable to start in 32bit OS
    By Amorabito in forum IC Imaging Control C++ Class Library
    Replies: 1
    Last Post: December 2, 2011, 08:31:24
  2. What the better Linux Operating System to Develop camera Application
    By ganesh2you in forum IC Imaging Control C++ Class Library
    Replies: 8
    Last Post: February 17, 2011, 11:19:46
  3. Problem:IC Capture AS Application doesn't start
    By Speedskater in forum Astronomy Cameras Support Forum
    Replies: 3
    Last Post: September 30, 2009, 16:54:47
  4. how to use two camera buffers using activeX? (in MFC application)
    By abdul_khathar in forum IC Imaging Control ActiveX
    Replies: 1
    Last Post: November 6, 2007, 13:31:31
  5. Explorer crashes when selecting captured files
    By Unregistered in forum IC Imaging Control .NET
    Replies: 3
    Last Post: June 27, 2005, 08:33:04

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •