How to detect whether or not user is running a full-screen program

Recently i was looking how to detect if a  user is runing a full screen program or not …

here is the code snippet:

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;
}
Bookmark and Share

Leave a Reply