Hello,
I'm trying to use the function RegisterDeviceNotification to handle when a USB device attaches or removes.
I have made my own class, CUSB, which contain all my USB handlings. CUSB is not a form class. I want to call CUSB::MyFunction on device change. My first question is, what should I send as HANDLE to RegisterDeviceNotification? When using TForm classes, which contain a HANDLE, they just send this->Handle; But I do not have such a HANDLE. Can I use just "this" as a HANDLE?
DeviceNotificationHandle = RegisterDeviceNotification(this, &DevBroadcastDeviceInterface, DEVICE_NOTIFY_WINDOW_HANDLE);
The other question is: how do I set CUSB::MyFunction to called when a WM_DEVICECHANGE message occurs?
Regards
Eimund Smestad
ASKER
Is there a way to use the HANDLE to my USB device to check if it is still attached or detached?
Eimnund Smestad