I have written a service in VC++. I followed the tutorial here. Now, I am trying to find out how to receive messages like DBT_DEVICEARRIVAL, DBT_DEVICEREMOVECOMPLETE, WM_COP
Use RegisterServiceCtrlHandlerEx function with HandlerEx callback function.
Yes, as pointed by 0xC0000022L is better use IPC technique, for example named pipes - my favourite. :)