CYAPI - Detect if some other application is using the USB device

Question: How do I detect using the CYAPI library, if some other application is already using my USB device?

 

Answer:

The IsOpen() method can be used to check the same. This method is a member of the CCyUSBDevice class. The IsOpen( ) method returns true if CCyUSBDevice object already has a valid handle to a device attached to the CyUSB driver.

For example: 

 

if(USBDevice -> IsOpen())
{
// The device is open and is being used by another application
// This condition is also true if the current application has opened the device and has a handle
}