I need a WinAPI/C++ function that can detect connected USB device by VendorID and productID. The code should look like 2 functions:
void Init(); // init code
bool IsUSBDevConected(int vid, int pid); // detect presence of the device.
void Release(); // release code
IsUSBDevConected will called once per second. The device is USB keyborad.
The code should be compiled under VisualC++ 6.0 or Visual Studio 2005.
I expect to receive a simple MFC/WinAPI dialog box application that demonstrates how these 3 functions works to detect a presence of a USB device. application should call IsUSBDevConected() once per second to dynamically show connected or not the device.
On my PC I will change Vid & Pid in the code to test it with my device.
But coder can test it with any USb flash drive or any USb mouse.
The device name is not important for me. And I assume that there will be only one connected USB device with that Vid & Pid.