在 Windows 中检测全屏应用程序退出 [英] Detecting Fullscreen App Exit in Windows

查看:30
本文介绍了在 Windows 中检测全屏应用程序退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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?

推荐答案

就操作系统而言,没有全屏模式"或窗口模式"之类的东西.窗口只有尺寸,可能恰好与屏幕尺寸相同或不同.拥有窗口的应用程序控制该行为,而不是操作系统,因此只有应用程序知道它何时以全屏"或窗口化"模式显示窗口.

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.

话虽如此,应用程序可以选择在更改模式时使用 CDS_FULLSCREENCDS_RESET 标志调用 ChangeDisplaySettings/Ex().这将向所有顶级窗口发送 WM_DISPLAYCHANGE 通知,但不会告诉他们是否正在显示全屏窗口.

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.

至于检测进程终止,WMI 有一个事件.请参阅通过 WMI 接收事件通知.

As for detecting process termination, WMI has an event for that. See Receiving Event Notifications Through WMI.

这篇关于在 Windows 中检测全屏应用程序退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆