| lukescott (11) | |
|
Hello, I'm writing a console application and I need to detect when the screen resolution changes, or (if running on a computer with dual monitors) when a screen changes orientation from another. I would like to avoid using any sort of polling method. I've heard of WM_DISPLAYCHANGE, but I can't figure out how to actually capture it without creating a window. It's important that I don't create a window as this application has to run in the background and can't interfere with any active windows. The application itself makes use of mouse and keyboard low level hooks. It allows you to extend your desktop to another computer (that can be of a different OS). When the application starts I'm going to have it check for specific coordinates to "warp" the cursor to the other machine. Having the screen resolution change can screw this up, thus is the reason for this question. Luke | |
|
|
|
| chris (82) | |||
|
Okay, using the WM_DISPLAYCHANGE message only works with top level windows, that having been said, one can just make a top level window that never gets displayed. The following code makes a simple window (no height, width, menus, icons, cursor et cetera) & then sets up a message loop, handles the WM_DISPLAYCHANGE message with a MessageBox (put your code there).
Hope this helps. | |||
|
|
|||
| lukescott (11) | |
| Works perfectly, thanks! | |
|
|
|