I am writing an Alt+Tab replacement in C#, and have trouble with fullscreen applications.
Is there a way to detect if a SetForegroundWindow(hWnd)
call is going to change the screen resolution? Or equivalently, if hWnd
is a fullscreen application? I would like to wait until the resolution change is done, or if there is no change, proceed immediately.
The screen resolution change is done asynchronously, the function call returns well before it happens, so my code runs prematurely, and draws my application onto the surface of the fullscreen application, with wrong dimensions, then after the resolution change, it looks especially ugly.
Source of my application is at https://bitbucket.org/FrigoCoder/frigotab/src if anyone is interested.
To clarify, I would be more interested in knowing beforehand if a resolution change occurs than detecting it later. I already know a half-solution where I call SetForegroundWindow()
on GetDesktopWindow()
or some other window and watch SystemEvents.DisplaySettingsChanging
and DisplaySettingsChanged
. This however only gives me a late asynchronous notification if a resolution change occurs, and does not tell me if it does not.