2

Does Windows send any message if the monitors poisition changed?

e.g. I get messege if a new monitor plugged in the PC from WM_DEVICECHANGE.

I need a message like this, when I change the position of the monitors.

( On poisiton i mean: First monitor to the left, second monitor to the right. After that i change the poisiton, first monitor the the right, second monitor the the left. )

Golyo
  • 65
  • 1
  • 6
  • I found this: http://msdn.microsoft.com/en-us/library/ms695534(v=vs.85).aspx from this http://stackoverflow.com/questions/11004051/how-to-recognize-when-number-position-or-resolution-of-monitors-has-changed – Lucian Nov 16 '12 at 10:40

1 Answers1

1

You could listen for WM_DISPLAYCHANGE message.

The documentation says that it is sent on monitor resolution change, but my experimenting with Spy++ on Win7 shows that it is sent on multiple monitors arrangement change as well (in fact, it is the only system-wide notification which is sent at that moment).

Andriy
  • 8,486
  • 3
  • 27
  • 51
  • I saw that, the WM_DISPLAYCHANGE message sent when changed the poistion, but it only contains the bit depth, and resolution. I cannot determine where are the monitors. – Golyo Nov 16 '12 at 10:56
  • @Golyo how do you originally determine the monitors' position? Can you not re-call that method when you get an event from WM_DISPLAYCHANGE? – Ian Nov 16 '12 at 10:59
  • @Golyo: use [GetMonitorInfo](http://msdn.microsoft.com/en-us/library/dd144901%28VS.85%29.aspx) – Andriy Nov 16 '12 at 11:30
  • What I want to avoid, is to ask the system about the poisitions and stuff, I'd like to be notified if something happened. – Golyo Nov 16 '12 at 12:11
  • But, thats gonna be the answer, if i get a WM_DISPLAYCHANGE message, and no resolution or bit depth change happened, I will ask the system about the positions! – Golyo Nov 16 '12 at 12:29