I am trying to communicate with two camera’s using two instances of the same program where I can set the port I want to connect to.
TryOpenPort code
var scannerPort = int.Parse(ScannerPortTextBox.Text);
DeviceFactory.TryOpenPort("GenICam.vin", scannerPort, out Device device)
When I first connect to port 1, then with the second instance to port 0, this works. But when I first connect to port 0, then to port 1 with the second instance it returns false (device=null).
first of all I want to say sorry for the late response!
When loading the vin driver, port 0 gets automatically loaded before it switches to the desired port.
Since opening a specific port twice isn’t possible (at least if you do it from different processes), it makes sense, that you can’t load the driver, if you already opened port 0 before. To fix this, you need to adjust the GenICam.ini file. It is located at %CVB%Drivers. Simply enable the following flag:
AutoSwitchEnable=1
All it does, is letting the driver check if the port, it currently wants to load, is already in use, and if so, it changes to the next port or as in your case: to the desired port.
The path is not correct or has changed. I found GenICam.ini in folder “c:\ProgramData\STEMMER IMAGING\Common Vision Blox\Drivers” or %CVBDATA%Drivers or %CVBCONFIG%Drivers.
that is my chance to nit-pick
In fact the file used to be located in %CVB%\Drivers up until Windows XP. With Windows Vista File System Virtualization and UAC on C:\Program Files kicked in and it no longer was a good idea to store the configuration there, so we found a new spot for it in the location C:\ProgramData\STEMMER IMAGING\Common Vision Blox and to make it less fussy added %CVBDATA%. This was introduced in CVB 10.00.000 which was the first version to actually run properly on Windows Vista. However, 10.x and later still used to install the file to %CVB%\Drivers when installed on a Windows XP machine…