gpt4 book ai didi

c++ - 在 C++ 中检测 youtube 的全屏模式

转载 作者:可可西里 更新时间:2023-11-01 10:38:30 25 4
gpt4 key购买 nike

我期待以某种方式在 C++ 中检测用户是否在全屏模式下拥有一些网络应用程序,例如 Youtube。

这样我就可以避免显示焦点通知,因此不会打扰用户。

编辑1

  • 应支持 Windows XP SP III 及更高版本(或至少支持适用于 Win 7 及更高版本。)

最佳答案

以下代码来自http://www.deanlee.cn/windows/how-to-detect-whether-or-not-user-is-running-a-full-screen-program/ .

bool IsFullScreenMode()
{
int w = GetSystemMetrics(SM_CXSCREEN);
int h = GetSystemMetrics(SM_CYSCREEN);

HWND hWnd = 0;
while (hWnd = FindWindowEx(NULL, hWnd, NULL, NULL))
{
if (GetWindowLong(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
{
RECT rcWindow;
GetWindowRect(hWnd, &rcWindow);
if ((w == (rcWindow.right - rcWindow.left)) &&
(h == (rcWindow.bottom - rcWindow.top)))
return true;
}
}
return false;
}

关于c++ - 在 C++ 中检测 youtube 的全屏模式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12030853/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com