Home Image-Pro Automation (Macros, Apps, Reports)

Check camera devices available in Add-in?

Dear All,

In Project Workbench, I can use 'ThisApplication.Capture.Devices.Count' to get device count.
Using '
ThisApplication.Capture.ActiveDevice.DevName' to get current device name.

But 
those command isn't support in Add-in Project.
How do I know if there are any camera devices available?

Best Answer

  • Answer ✓
    My mistake, I missed putting the line to run the command to retrieve the value. Please try the following code:

            Dim DeviceCount As Integer = 0
            With MediaCy.Automation.Capture.GetDeviceCount(Nothing)
                .Run()
                DeviceCount = .Output.Value
            End With

Answers

  • Addins should be able to call the same functions as macros. Just be sure that your addin has all necessary references (e.g. MediaCy.IQL.Capture.dll, MediaCy.Addins.Capture.dll).

    Yuri
  • Hi Yuri,

    I include all of the capture's reference and test command. 
    But I can't find the suitable command.

    Automation command in Project Workbench. I see the 'GetDeviceCount' and 'GetDeviceObject'.




    In my Add-in project. The following are the capture item that I can use.

  • Please make sure MediaCy.Automation.dll is referenced in the project. It is located in a subfolder of the application folder called Automation (C:\Program Files\Media Cybernetics\Image-Pro 10\Automation). If you have a reference to MediaCy.Automation.Proxy.dll, it should be removed. This is not the reference to use.

    Once the automation reference is available, you should see all of the capture commands as in project workbench.

    Example:

            Dim DeviceCount As Integer = 0
            With MediaCy.Automation.Capture.GetDeviceCount(Nothing)
                DeviceCount = .Output.Value
            End With



  • edited September 2018
    Hi Trey,

    Thanks for your help! 
    I found out where is difference in automation.dll.
    My reference path was old version of the dll.
  • edited September 2018
    Hi All,

    I have another question.
    I using QImaging Camrea. Then i tested command GetDeviceCount and got .Output.value =0.
    It did not return the correct count. 
    Is there any other way to get device count or get device list ?


    The following are my test results: 

    Sample Code:
            Dim captDeviceCount As Integer = 0
            With mediacy.Automation.Capture.CaptureCommands.GetDeviceCount(NewMacro)
                captDeviceCount = .Output.Value
            End With
    
            MsgBox ("DeviceCount:" & captDeviceCount.ToString)
            MsgBox ("Application: " & ThisApplication.Capture.Devices.Count.tostring)
      

            MsgBox ThisApplication.Capture.Devices.Item(0).DevName & vbNewLine & ThisApplication.Capture.Devices.item(1).DevName
    

Sign In or Register to comment.