Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
664 views
in Technique[技术] by (71.8m points)

.net - Getting an event on monitor hotplug for windows

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...