Does Windows provide some sort of mechanism to detect when an app running in fullscreen mode (e.g. games, media players, etc.) exits fullscreen mode, either returning to windowed mode or exiting its process?
2 Answers
There is no such thing as "fullscreen mode" or "windowed mode" as far as the OS is concerned. A window simply has dimensions, which may happen to be the same as the screen dimensions or not. The application that owns the window controls that behavior, not the OS, so only the application knows when it is displaying the window in "full screen" or "windowed" mode.
That being said, the application may optionally call ChangeDisplaySettings/Ex()
with the CDS_FULLSCREEN
or CDS_RESET
flag when changing modes. That will send WM_DISPLAYCHANGE
notifications to all top-level windows, but it will not tell them that a fullscreen window is being displayed or not.
As for detecting process termination, WMI has an event for that. See Receiving Event Notifications Through WMI.

- 555,201
- 31
- 458
- 770
-
I always thought Fullscreen applications were different that Fullscreen borderless applications. The reason behind this was because of the flicker present on window creation on the first and the lack of it on the latter. Doesn't Fullscreen apps take ownership of graphics on Windows during foreground execution? – rlam12 Oct 16 '16 at 04:24
-
@rlam12 fullscreen apps are just fullscreen windows, nothing special about them. I don't know the flicker you are referring to, but a "fullscreen" window doesn't "take ownership of graphics", it is drawn normally like any other window. – Remy Lebeau Oct 16 '16 at 06:56
-
@rlam12: Ever since the introduction of the DWM, the GPU is no longer exclusively used by an application, fullscreen or not (see [The role of the Windows Display Driver Model in the DWM](https://blogs.msdn.microsoft.com/greg_schechter/2006/04/02/the-role-of-the-windows-display-driver-model-in-the-dwm/)). – IInspectable Oct 16 '16 at 10:54
A simple approach to this, and what I decided to go with, is using RegisterWaitForSingleObject
on the created process as explained here: https://stackoverflow.com/a/22418949/1019385
I found it more approachable than the WMI solution.

- 3,094
- 1
- 30
- 46