Add the following member variables and member functions (using classwizard) in the CMAINFRAME class. The following is the functional description of these variables and functions:
Member variables: BOOL m_bFullScreen; // full screen display signs CRect m_FullScreenWindowRect; // display a full-screen window RectWINDOWPLACEMENT m_wpPrev; // window position is saved for normal view information CToolBar * m_wndFullScreenBar; // full-screen display of a floating toolbar
Member function: void onmenufullscreen (); // full-screen display processing function void onlineMAXINFO (); // Capture the WM_GETMAXMAXINFO message to allow you to add window size void onupdateViewFullScreen (); // Update the Status of the "Full Screen Display" menu
Source
Void CMAINFRAME :: onmenufullscreen () {// full screen display processing function RectDesktop; WindowPlacement WpNew;
IF (m_bfullscreen) {// full-screen display mode // Hide toolbar and status bar m_wndstatus bar.showwindow (sw_hide); m_wndtool bar.showwindow (sw_hide);
/ / Save the window location information when the normal view is to restore the original state getWindowplacement; m_wpprev.length = sizeof m_wpprev;
// Adjust the Rect for the new window Size :: getWindowRect (: getDesktopWindow (), & reviewsktop); :: AdjustWindowRectex (& RectDesktop, getStyle (), true, getExstyle ();
/ / Save the Rect so ONGETMINMAXINFO () Use m_fullscreenwindower = RectDesktop;
WPNEW = m_wpprev; wpnew.showcmd = sw_shownormal; wpnew.rcnorPosition = RectDesktop;
/ / Generate new toolbar m_wndfullscreenbar = new ctoolbar;
(!! M_wndFullScreenBar-> Create (this, CBRS_SIZE_DYNAMIC | CBRS_FLOATING) || m_wndFullScreenBar-> LoadToolBar (IDR_FULLSCREEN)) if {TRACE0 ( "Failed to create toolbar / n"); return; // fail to create}
// do not allow the toolbar parked m_wndFullScreenBar-> EnableDocking (FALSE); m_wndFullScreenBar-> SetWindowPos (0,100,100,0,0, SWP_NOSIZE | SWP_NOZORDER | SWP_NOACTIVATE | SWP_SHOWWINDOW); m_wndFullScreenBar-> SetWindowText (_T ( "full screen")); FLOATCONTROLBAR, CPOINT (100,100)); m_bfullscreen = true;} else {// Normal display mode // Remove full screen toolbar m_wndfullscreenbar-> destroyWindow (); delete m_wndfullscreenbar;
m_bfullscreen = false;
// Restore toolbar and state bar m_wndstatus bar.showwindow (sw_shownormal); m_wndtool bar.showwindow (sw_shownormal); WPNEW = m_wpprev;} // Setting window display status setWindowPlacement (& WPNEW);
void CMainFrame :: OnGetMinMaxInfo (MINMAXINFO FAR * lpMMI) {if (m_bFullScreen) {lpMMI-> ptMaxSize.y = m_FullScreenWindowRect.Height (); lpMMI-> ptMaxTrackSize.y = lpMMI-> ptMaxSize.y; lpMMI-> ptMaxSize.x = m_fullscreenwindowRect.width (); lpmmi-> ptmaxTracksize.x = lpmmi-> ptmaxsize.x;}}
Void CMAINFRAME :: OnUpdateMenufullscreen (ccmdui * pcmdui) {// update menu status PCMDUI-> enable (); pcmdui-> setcheck (m_bfullscreen);