Get notification about Windows 10's Revert/Keep new display settings dialog Get notification about Windows 10's Revert/Keep new display settings dialog windows windows

Get notification about Windows 10's Revert/Keep new display settings dialog


WM_DISPLAYCHANGE is the correct way. It is sent when the resolution really changes. That is, right before the dialog appears, and when you hit revert. It is not sent if you keep the resolution.

The 15 second window, with keep and revert buttons, is a #32770 dialog. When you use the OS dialog, the launching process is explorer.exe. It does show on my spyxx - see below. Just hit the Windows button when the dialog is showing and look for it.

You can change resolution without the dialog. Graphics cards usually have their own software with or without some other dialog. Any software can change the resolution using ChangeDisplaySettings.

You probably can track down the OS dialog, but this would be very fragile, so I would not recommend it.
If you really need to see the system dialog, you can enum all top level windows when you get WM_DISPLAYCHANGE.
I guess you'd have to enum continuously for at least a second, and look for that pattern of child windows, captions, classes, window position (center of primary screen). You would have to do that per OS version and per language.
You can also enum windows periodically, before you receive WM_DISPLAYCHANGE, and then look for changes in top level windows after the resolution change.

enter image description here

EDIT:
As requested, here's some code to see the dialog:

std::map<std::string,int> windows;BOOL CALLBACK onEnumWindow( HWND hwnd, LPARAM lParam ){    char buf[500];    if( IsWindowVisible(hwnd) && GetWindowText(hwnd,buf,500) > 0 )        windows[buf]++;    return TRUE;}std::string getLayout(){    std::string layout;    EnumWindows(onEnumWindow, 0);    for( auto& w : windows ) {        if( w.first == "Display Settings" ) layout += "**** ";        layout += std::to_string(w.second) + "x " + w.first + "\n";    }    windows.clear();    return layout;}int _tmain(int argc, _TCHAR* argv[]){    std::string layout0;    for(;;) {        std::string layout = getLayout();        if( layout != layout0 ) { // <-- you should test that across res change            printf("%s\n", layout.c_str());            layout0 = layout;        }    }    return 0;}

And here's it's output:

1x C:\Users\yakov\Documents\Visual Studio 2013\Projects\desk\x64\Release\desk.exe1x EnumWindows function (Windows) - Google Chrome1x Program Manager1x Screen Resolution1x Start1x desk (Running) - Microsoft Visual Studio1x C:\Users\yakov\Documents\Visual Studio 2013\Projects\desk\x64\Release\desk.exe**** 1x Display Settings1x EnumWindows function (Windows) - Google Chrome1x Program Manager1x Screen Resolution1x Start1x desk (Running) - Microsoft Visual Studio1x C:\Users\yakov\Documents\Visual Studio 2013\Projects\desk\x64\Release\desk.exe1x EnumWindows function (Windows) - Google Chrome1x Program Manager1x Screen Resolution1x Start1x desk (Running) - Microsoft Visual Studio

Another thing to note - if screen resolution triggers UAC in win10, or future OSs, you can not detect the dialog. You're still notified of the resolution change.
The UAC dialog is not detectable as it runs in a desktop that is accessible only to the system account.


Try finding that window using FindWindowEx , with a child window or main window with that specific text...