2011-08-10 30 views
11

Bazı uygulamaların şu anda tam ekran modunda çalışıp çalışmadığını tespit etmem gerekiyor. Eğer evetse, başvurumu durdurmalıyım. Peki bunu nasıl tespit edebilirim? p.s. Win32 C++Windows'da tam ekran modunu algılama

cevap

8
hWnd = GetForegroundWindow(); 
RECT appBounds; 
RECT rc; 
GetWindowRect(GetDesktopWindow(), &rc); 

Ardından bu pencerelerin masaüstü veya kabuk olmadığını kontrol edin. Talimatlar basitse.

if(hWnd =! GetDesktopWindow() && hWnd != GetShellWindow()) 
{ 
    GetWindowRect(hWnd, &appBounds); 
    // Now you just have to compare rc to appBounds 
} 

Bu, test edilmeden yazılmıştır.

+0

Çok teşekkürler, bu çok yardımcı! – lebron2323

1

Hooch en Yanıta tam olarak uygulanması:

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); 
}