Reputation: 22054
As the title states.
I'd like to be able to tie into an event somehow that notifies my application when the screen resolution is going to change, or screens are added/removed.
Mainly I want to write an app that keeps track of where applications are running on my multiple screens, so that when I undock my laptop, and then redock it, it can reposition windows where they were, instead of stacking them all on my primary monitor.
(re: to solve this problem: https://superuser.com/questions/289908/windows-7-constantly-forgets-my-dual-monitor-setup)
Upvotes: 3
Views: 151
Reputation: 124
You can use the DisplaySettingsChanged event. The SystemParameters class will give you limited information about the primary screen as well as the virtual screen (the bounding rectangle of all your screens; only useful for simple setups), but if you want more specific information you'll probably need to pinvoke the Win32 API.
Upvotes: 2