I’ve had this problem for a while now but I have to remedy it as I must tackle it now. I’m trying to detect when a device is connected to the system in windows 7 and I receive the WM_DEVICECHANGE just fine, however the message in wParam is always DBT_DEVNODES_CHANGED. Never a DBT_DEVICEARRIVAL or DBT_DEVICEREMOVECOMPLETE. I have had no luck googling thus far so I’m hoping someone will point me in the right direction before I find something in a few hours time 🙂
Thanks for ya time.
I’ve had this problem for a while now but I have to remedy it
Share
The documentation states that the DBT_DEVICEARRIVAL and DBT_DEVICEREMOVECOMPLETE events should be received by default. The application can register to receive more detailed events by calling the RegisterDeviceNotification function. Hopefully you will receive the events you need after registering your app. Be sure to call UnregisterDeviceNotification upon closedown.
RegisterDeviceNotification reference:
http://msdn.microsoft.com/en-us/library/aa363431%28v=VS.85%29.aspx
P/Invoke Signature:
http://pinvoke.net/default.aspx/user32.RegisterDeviceNotification
UnregisterDeviceNotification reference:
http://msdn.microsoft.com/en-us/library/aa363475%28v=VS.85%29.aspx
P/Invoke Signature:
http://pinvoke.net/default.aspx/user32.UnregisterDeviceNotification