判断全屏模式

判断全屏模式

BOOL IsFullScreenMode()
{
 BOOL bRet = FALSE;

 HWND hDesktopWindow = GetDesktopWindow();
 HWND hShellWindow = GetShellWindow();

 DWORD dwDesktopWindow = 0, dwShellWindow = 0;

 GetWindowThreadProcessId(hDesktopWindow, &dwDesktopWindow);
 GetWindowThreadProcessId(hShellWindow, &dwShellWindow);

 const INT nWidth = GetSystemMetrics(SM_CXSCREEN);
 const INT nHeight = GetSystemMetrics(SM_CYSCREEN);

 DWORD dwTmp = 0;

 HWND hTmp = FindWindowEx(NULL, NULL, NULL, NULL);

 while (hTmp != NULL)
 {
  CRect rect;

  GetWindowRect(hTmp, &rect);

  if (nWidth == rect.Width() && nHeight == rect.Height())
  {
   GetWindowThreadProcessId(hTmp, &dwTmp);

   if (dwTmp != dwShellWindow && dwTmp != dwDesktopWindow)
   {
    bRet = TRUE;

    TRACE("FullScreen:%d\n", dwTmp);

    break;
   }
  }

  hTmp = FindWindowEx(NULL, hTmp, NULL, NULL);
 }

 return bRet;
}

 

你可能感兴趣的:(判断全屏模式)