How MFC implements full-screen functionality

Source: Internet
Author: User

Many players have shortcut control windows that are displayed in full screen mode. Adding full-screen functionality to your application does not require a lot of code, such as adding full-screen functionality to a dialog-based application that only requires the following small amount of code to work.

Many players have shortcut control windows that are displayed in full screen mode. Adding full-screen functionality to your application does not require a lot of code, such as adding full-screen functionality to a dialog-based application that only requires the following small amount of code to work.

The code is as follows:

void Cfullscreendlg::fullscreenview (void)

{

RECT Rectdesktop;

Windowplacement wpnew;

if (! IsFullScreen ())

{

We ' ll need these to restore the original state.

GetWindowPlacement (&m_wpprev);

Adjust RECT to new size of window

:: GetWindowRect (:: GetDesktopWindow (), &rectdesktop);

:: Adjustwindowrectex (&rectdesktop, GetStyle (), FALSE, Getexstyle ());

Remember this for OnGetMinMaxInfo ()

M_rcfullscreenrect = Rectdesktop;

Wpnew = M_wpprev;

Wpnew.showcmd = Sw_shownormal;

Wpnew.rcnormalposition = Rectdesktop;

M_bfullscreen=true;

}

Else

{

Revert to the original window state when exiting full screen

M_bfullscreen=false;

Wpnew = M_wpprev;

}

SetWindowPlacement (&wpnew);

}

void Cfullscreendlg::ongetminmaxinfo (minmaxinfo* lpmmi)

{

Todo:add your message handler code here and/or call default

if (IsFullScreen ())

{

Lpmmi->ptmaxsize.y = M_rcfullscreenrect.height ();

Lpmmi->ptmaxtracksize.y = lpmmi->ptmaxsize.y;

lpmmi->ptmaxsize.x = M_rcfullscreenrect.width ();

lpmmi->ptmaxtracksize.x = lpmmi->ptmaxsize.x;

}

Cdialog::ongetminmaxinfo (Lpmmi);

}

BOOL Cfullscreendlg::isfullscreen (void)

{

Record whether the window is currently in full-screen state

return m_bfullscreen;

}650) this.width=650; "src=" Http://images.enet.com.cn/end.gif "height=" one "width=" one "border=" 0 "alt=" end.gif "/>

The code is complete.


How MFC implements full-screen functionality

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.