Can windows detect when monitor, mouse, keyboard are disabled?

Can windows detect when a monitor, mouse, or keyboard is disconnected from the computer? If so, which Win32 API is used for this?

+2


source to share


3 answers


Not sure about the monitor, but a disabled keyboard and mouse should message WM_DEVICECHANGE if they are USB devices. See this link for more information: WM_DEVICECHANGE

There is a good discussion of WM_DEVICECHANGE in this forum regarding its use with HID devices (Mouse / Keyboard / etc.)



For more detailed notification you can use the RegisterDeviceNotification function RegisterDeviceNotification

+3


source


To respond to monitor changes, handle WM_DISPLAYCHANGE (see http://msdn.microsoft.com/en-us/library/dd145210%28VS.85%29.aspx ).



+1


source


As far as I remember, there is no way to detect PS / 2 disconnect events. The monitor and USB might be trapped, but I don't know how.

0


source







All Articles