Reputation: 5696
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?
Upvotes: 0
Views: 1065
Reputation: 3189
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.
Upvotes: 0
Reputation: 595981
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.
Upvotes: 1