11
我需要檢測某些應用程序當前是否以全屏模式運行。如果是,那麼我必須停止我的申請。那麼我怎麼能檢測到? p.s. Win32 C++在Windows中檢測全屏模式
我需要檢測某些應用程序當前是否以全屏模式運行。如果是,那麼我必須停止我的申請。那麼我怎麼能檢測到? p.s. Win32 C++在Windows中檢測全屏模式
hWnd = GetForegroundWindow();
RECT appBounds;
RECT rc;
GetWindowRect(GetDesktopWindow(), &rc);
然後檢查該窗口是不是桌面或外殼。 簡單如果指令。
if(hWnd =! GetDesktopWindow() && hWnd != GetShellWindow())
{
GetWindowRect(hWnd, &appBounds);
// Now you just have to compare rc to appBounds
}
這是沒有測試寫的。
完全實施霍赫的回答:
bool isFullscreen(HWND window)
{
RECT a, b;
GetWindowRect(window, &a);
GetWindowRect(GetDesktopWindow(), &b);
return (a.left == b.left &&
a.top == b.top &&
a.right == b.right &&
a.bottom == b.bottom);
}
非常感謝,這非常有助於! – lebron2323