Windows detects whether a window is currently full screen

Source: Internet
Author: User

Sometimes I see someone asking how can I tell if a window is currently in full screen?
But before solving this problem, let's solve a simple problem.
What is fullscreen?
Quite a few people think: if the window is maximized, then it is maximized? Is that true? It's bs!.
Full screen means that the overall size of the window occupies at least the entire screen, not just a portion of the space except the taskbar!
Maximizing is the window's overall size, which occupies the desktop's workspace (workarea)!

Therefore, do not simply call iszoomed () to determine whether the window is currently full-screen, that is to judge whether to maximize the act;
Also do not just compare the client area size and screen size of the window;
Also do not just compare the window's left and top if it is less than 0.

Can be judged in the following ways:

1#include <windows.h>2#include <iostream>3 4 BOOLCheckfullscreen ()5 {6     BOOLBfullscreen =false;7HWND hwnd =GetForegroundWindow ();8 RECT Rcapp, Rcdesk;9GetWindowRect (GetDesktopWindow (), &rcdesk);Ten     if(Hwnd!=getdesktopwindow () && hwnd!=Getshellwindow ()) { OneGetWindowRect (HWnd, &Rcapp); A         if(rcapp.left<=Rcdesk.left -&& rcapp.top<=Rcdesk.top -&& rcapp.right>=Rcdesk.right the&& rcapp.bottom>=rcdesk.bottom) -         { -Bfullscreen =true; -         } +     } -     returnBfullscreen; + } A  at intMain () - { -      for(;;) { -Std::cout << (checkfullscreen)?"have a":"No") <<"window full Screen ~\n"; -Sleep ( +); -     } in     return 0; -}

Reference:
Http://stackoverflow.com/questions/7009080/detecting-full-screen-mode-in-windows
http://bbs.csdn.net/topics/390838652#post-397826207

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.