FullScreen

所属分类:Windows编程
开发工具:Visual C++
文件大小:19KB
下载次数:63
上传日期:2007-09-24 14:56:50
上 传 者庆庆庆
说明:  用VC2005实现全屏功能,一个函数就搞定了!!!请参看MainFrame中添加的函数。从此,你可以无忧无虑地轻轻松松地,自自在在的搞定全屏功能了。
(VC2005 realize with full-screen function, a function to get! ! ! Mainframe see added to the function. From then on, you can easily carefree manner, since the ease of get in a full-screen function.)

文件列表:
FullScreen\FullScreen.cpp (3666, 2007-09-24)
FullScreen\FullScreen.h (958, 2007-09-24)
FullScreen\FullScreen.rc (12709, 2007-09-24)
FullScreen\FullScreen.sln (884, 2007-09-24)
FullScreen\FullScreen.vcproj (8402, 2007-09-24)
FullScreen\FullScreenDoc.cpp (1818, 2007-09-24)
FullScreen\FullScreenDoc.h (1069, 2007-09-24)
FullScreen\FullScreenView.cpp (2699, 2007-09-24)
FullScreen\FullScreenView.h (1498, 2007-09-24)
FullScreen\MAINFRM.CPP (4046, 2007-09-24)
FullScreen\MAINFRM.H (1048, 2007-09-24)
FullScreen\RES\FULLSCREEN.ICO (1078, 1996-12-21)
FullScreen\RES\FULLSCREEN.RC (397, 1996-12-21)
FullScreen\RES\FULLSCREENDOC.ICO (1078, 1996-12-21)
FullScreen\RES\Thumbs.db (9728, 2007-09-24)
FullScreen\RES\Toolbar.bmp (1198, 2002-10-09)
FullScreen\RES\TOOLBAR2.BMP (238, 1996-12-21)
FullScreen\resource.h (689, 2007-09-24)
FullScreen\STDAFX.CPP (208, 2007-09-24)
FullScreen\STDAFX.H (499, 1996-12-21)
FullScreen\RES (0, 2007-09-24)
FullScreen (0, 2007-09-24)

ARTICLE-ID:Q1***162 TITLE :SAMPLE: Adding a Full Screen Feature to an MFC Application --------------------------------------------------------------------- The information in this article applies to: - The Microsoft Foundation Classes (MFC) included with: - Microsoft Visual C++, 32-bit Editions, versions 4.0, 4.1, 4.2 --------------------------------------------------------------------- SUMMARY ======= The FSCRN sample includes code that you can use to add a Full Screen feature to a Visual C++ 4.x MFC Application. This is similar to what you see when you select the Full Screen menu item in Microsoft Developer Studio. The code shows which functions must be created and demonstrates how you can create a floating toolbar, which you can click to undo the Full Screen mode. The following file is available for download from the Microsoft Software Library: ~ Fscrn.exe For more information about downloading files from the Microsoft Software Library, please see the following article in the Microsoft Knowledge Base: ARTICLE-ID: Q119591 TITLE : How to Obtain Microsoft Support Files from Online Services MORE INFORMATION ================ The sample code below has been added to the CMainFrame class of the AppWizard-generated application. Here is a list of the 4 functions and what they accomplish: OnViewFullScreen - Handler for the Full Screen menu item. OnGetMinMaxInfo - Traps the WM_GETMINMAXINFO message to allow you to increase the size of the window. IsFullScreen- Tests whether the application is in full screen mode. OnUpdateViewFullScreen - Checks or unchecks the Full Screen menu item depending on the mode the application is in. Sample Code ----------- void CMainFrame::OnViewFullScreen() { RECT rectDesktop; WINDOWPLACEMENT wpNew; if (!IsFullScreen()) { // need to hide all status bars m_wndStatusBar.ShowWindow(SW_HIDE); m_wndToolBar.ShowWindow(SW_HIDE); // We'll need these to restore the original state. GetWindowPlacement (&m_wpPrev); m_wpPrev.length = sizeof m_wpPrev; //Adjust RECT to new size of window ::GetWindowRect ( ::GetDesktopWindow(), &rectDesktop ); ::AdjustWindowRectEx(&rectDesktop, GetStyle(), TRUE, GetExStyle()); // Remember this for OnGetMinMaxInfo() m_FullScreenWindowRect = rectDesktop; wpNew = m_wpPrev; wpNew.showCmd = SW_SHOWNORMAL; wpNew.rcNormalPosition = rectDesktop; m_pwndFullScrnBar=new CToolBar; if(!m_pwndFullScrnBar->Create(this,CBRS_SIZE_DYNAMIC|CBRS_FLOATING) || !m_pwndFullScrnBar->LoadToolBar(IDR_FULLSCREEN)) { TRACE0("Failed to create toolbar\n"); return; // fail to create } //don't allow the toolbar to dock m_pwndFullScrnBar->EnableDocking(0); m_pwndFullScrnBar->SetWindowPos(0,100,100, 0,0,SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE|SWP_SHOWWINDOW); m_pwndFullScrnBar->SetWindowText(_T("Full Screen")); FloatControlBar(m_pwndFullScrnBar, CPoint(100,100)); m_bFullScreen=TRUE; } else { m_pwndFullScrnBar->DestroyWindow(); delete m_pwndFullScrnBar; m_bFullScreen=FALSE; m_wndStatusBar.ShowWindow(SW_SHOWNORMAL); m_wndToolBar.ShowWindow(SW_SHOWNORMAL); wpNew = m_wpPrev; } SetWindowPlacement ( &wpNew ); } void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { if (IsFullScreen()) { lpMMI->ptMaxSize.y = m_FullScreenWindowRect.Height(); lpMMI->ptMaxTrackSize.y = lpMMI->ptMaxSize.y; lpMMI->ptMaxSize.x = m_FullScreenWindowRect.Width(); lpMMI->ptMaxTrackSize.x = lpMMI->ptMaxSize.x; } } BOOL CMainFrame::IsFullScreen() { return m_bFullScreen; } void CMainFrame::OnUpdateViewFullScreen(CCmdUI* pCmdUI) { pCmdUI->Enable(); if (IsFullScreen()) pCmdUI->SetCheck(); else pCmdUI->SetCheck(0); }

近期下载者

相关文件


收藏者