Bullines
Bullines

Reputation: 5696

Detecting Fullscreen App Exit in Windows

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

Answers (2)

Mike Weir
Mike Weir

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

Remy Lebeau
Remy Lebeau

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

Related Questions