Can windows detect when a monitor, mouse or keyboard is disconnected from the computer? If so what Win32 API is used for this?
+3
A:
Not sure about the monitor, but the keyboard and mouse being disconnected should fire off a WM_DEVICECHANGE message if they are USB devices. See this link for details: WM_DEVICECHANGE
There is a good discussion of WM_DEVICECHANGE on this forum, relating to its usage with HID devices (Mouse/Keyboard/etc.)
For more detailed notification you can use the RegisterDeviceNotification function RegisterDeviceNotification
John Sibly
2009-09-17 09:10:35
A:
As far as I recall there is no way to detect PS/2 disconnection events. Monitor and USB can be trapped but I don't know how.
Cem Kalyoncu
2009-09-17 09:10:42
Well, PS/2 has no disconnection events because it simply doesn't support getting unplugged while in use. And this can fry your controller if you do it :-)
Joey
2009-09-17 09:15:32