3

I'd really like to listen for when a monitor gets hotplugged like when a laptop docs or has a external monitor plugged in.

I'm hoping I can do this in .net maybe with some pinvoke.

Joel Barsotti
  • 3,031
  • 7
  • 35
  • 59
  • Oh I've had a little more luck with a similar question differently worded: http://stackoverflow.com/questions/5981520/detect-external-display-being-connected-or-removed-under-windows-7 – hippietrail May 13 '11 at 07:46
  • Does this answer your question? [Detect external display being connected or removed under Windows 7](https://stackoverflow.com/questions/5981520/detect-external-display-being-connected-or-removed-under-windows-7) – Werner Henze May 13 '20 at 15:47

1 Answers1

0

As said here:

When adding a monitor on Windows 7 x64 I see registered messages "UxdDisplayChangeMessage" and "HotplugDetected". You can use RegisterWindowMessage to get the identifier for these messages and later just handle messages with this identifier.

Werner Henze
  • 16,404
  • 12
  • 44
  • 69