C++/MFC Detecting Removable Media Device Insert/Remove in a Windows Service?

jonny

New member
I have managed to do this before in a normal C++/MFC application by handling the event of a hardware change from the message map event "OnDeviceChange()" (or something along those lines). However I'm not sure how you would do this in a Windows Service as there is no window/UI? Is it even possible? I need to do this in C++/MFC. Any example projects or code snippets would be a great help.

Basically at the moment I've got a Windows Service which installs, runs, can be killed, and uninstalled. What I need for is it to write to a text file (which I can already do) each and every time a USB device is inserted/removed.

Thanks in advance!
 
Back
Top