API enables full screen/full screen recovery of a specified window

Source: Internet
Author: User
Bool fullscreenviewctrl (hwnd m_hwnd, // The Window handle bool bfullscreen to be full screen) // ture to full screen false to exit full screen {static hwnd pparentwndsave = NULL; // parent window handle static DWORD dwwindowstylesave = 0; // window style static rect rcwndrectsave = {0, 0, 0}; // window Position static bool benterfullview = false; // enter full screen? _ Assert (iswindow (m_hwnd); If (bfullscreen) {If (! Benterfullview) // non-full screen mode {dwwindowstylesave = getwindowlong (m_hwnd, gwl_style); // Save the window style getwindowrect (m_hwnd, & rcwndrectsave ); // Save the window position pparentwndsave = setparent (m_hwnd, null); // Save the parent window handle/set the parent window setwindowlong (m_hwnd, gwl_style, dwwindowstylesave &(~ Ws_child) | summary); // make the window have a popup style setwindowpos (m_hwnd, hwnd_top, 0, 0, getsystemmetrics (sm_cxscreen), getsystemmetrics (sm_cyscreen), callback | scheme | swp_framechanged ); // modify the window to set full screen benterfullview = true; // enter full screen mode} else {If (benterfullview) // It is full screen mode {setwindowlong (m_hwnd, gwl_style, windowstylesave ); // restore the window style setparent (m_hwnd, pparentwndsave); // restore the parent window handle point ptlt = {rcwndrectsa Ve. left, rcwndrectsave. top}; screentoclient (m_hwnd, & ptlt); movewindow (m_hwnd, ptlt. x, ptlt. y, rcwndrectsave. right-rcWndRectSave.left, rcwndrectsave. bottom-rcWndRectSave.top, true); // Restore original position benterfullview = false; // exit full screen mode} return benterfullview; // return whether it is full screen ?}

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.