Why is the device reported as not available in the HSAcquisitionDevice after a load?
If you don't see the nag screen when starting the application, it's possible that you have a second instance of the HSAcquisitionDevice in the system. There must be only one HSAcquisitionDevice throughout the system, to interact with the devices. Any additional HSAcquisitionDevice will not be able to use any device. These additional HSAcquisitionDevice can only do emulation, image copy, or calibration assignment.
That being said, to avoid having more than one HSAcquisitionDevice in the system, you have to follow these precautions:
- Don't add more than one HSAcquisitionDevice in the process manager. If you do, it should be done intentionally, only for purposes explained above.
- If you have more than one HSApplication, there can also be only one HSAcquisitionDevice for all of them. Only one can communicate with the devices, and it will be the first one instantiated.
- If you are using Visual Studio, make sure the Designer (UI editor) is not open in Visual Studio. For editing purposes, the HSApplication control in the form will capture the devices and prevent any other instance from seeing them. This is particularly true when debugging.
- Make sure you have one and only one instance of application running at a time. Open the TaskManager to see if you do not have a hidden and unterminated instance of your application running in the background.
- Finally, when programming, if you use the GetProcess() or the Process() accessors to get the HSAcquisitionDevice, you must call the ReleaseComObject() or FinalReleaseComObject() fucntions after. If these functions are not called, a handle is maintained to the object, and it will keep the HSAcquisitionDevice alive. Trying to delete it will fail and any subsequent instantiation of a HSAcquisitionDevice will report the devices as not available.
Dim lAcquisition As HSACQUISITIONDEVICELib.HSAcquisitionDevice
lAcquisition = applicationControl.ProcessManager.Process("Acquisition") applicationControl.ProcessManager.Execute("Acquisition") System.Runtime.InteropServices.Marshal.FinalReleaseComObject(lAcquisition) lAcquisition = Nothing