www.pudn.com > cmy3.rar > MainFrm.cpp


// MainFrm.cpp : implementation of the CMainFrame class 
// 
 
#include "stdafx.h" 
#include "cmy.h" 
 
#include "MainFrm.h" 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame 
 
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd) 
 
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd) 
	//{{AFX_MSG_MAP(CMainFrame) 
	ON_WM_CREATE() 
	ON_WM_GETMINMAXINFO() 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
static UINT indicators[] = 
{ 
	ID_SEPARATOR,           // status line indicator 
	ID_INDICATOR_CAPS, 
	ID_INDICATOR_NUM, 
	ID_INDICATOR_SCRL, 
}; 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame construction/destruction 
 
CMainFrame::CMainFrame() 
{ 
	// TODO: add member initialization code here 
    fullscreenkey=FALSE;	 
	 
} 
 
CMainFrame::~CMainFrame() 
{ 
} 
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{ 
	if (CFrameWnd::OnCreate(lpCreateStruct) == -1) 
		return -1; 
	 
//	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP 
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | CBRS_TOP 
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) 
	{ 
		TRACE0("Failed to create toolbar\n"); 
		return -1;      // fail to create 
	} 
 
//	if (!m_wndStatusBar.Create(this) || 
	if (!m_wndStatusBar.Create(this, WS_CHILD | CBRS_BOTTOM) || 
		!m_wndStatusBar.SetIndicators(indicators, 
		  sizeof(indicators)/sizeof(UINT))) 
	{ 
		TRACE0("Failed to create status bar\n"); 
		return -1;      // fail to create 
	} 
 
//¶¨Òå״̬À¸ 
	if(m_wndStatusBar){ 
			  m_wndStatusBar.SetPaneInfo(0,0,SBPS_STRETCH,50); 
			  m_wndStatusBar.SetPaneInfo(1,0,0,50); 
		      m_wndStatusBar.SetPaneInfo(2,0,SBPS_STRETCH,50); 
 		      m_wndStatusBar.SetPaneInfo(3,0,SBPS_STRETCH,50); 
		  }; 
//ȫƴÏÔʾ 
	          fullscreenkey=TRUE; 
              CRect winme,clientme; 
              GetWindowRect(&winme); 
              RepositionBars(0,0xffff,AFX_IDW_PANE_FIRST,reposQuery,&clientme); 
              ClientToScreen(&clientme); 
              int fullwide=GetSystemMetrics(SM_CXSCREEN);	 
              int fullhide=GetSystemMetrics(SM_CYSCREEN); 
 
              mefullscreen.left=winme.left-clientme.left; 
              mefullscreen.top=winme.top-clientme.top; 
              mefullscreen.right=winme.right-clientme.right+fullwide; 
              mefullscreen.bottom=winme.bottom-clientme.bottom+fullhide; 
 
              WINDOWPLACEMENT winfull; 
              winfull.length=sizeof(WINDOWPLACEMENT); 
              winfull.flags=0; 
              winfull.showCmd=SW_SHOWNORMAL; 
              winfull.rcNormalPosition=mefullscreen; 
              SetWindowPlacement(&winfull); 
 
	// TODO: Delete these three lines if you don't want the toolbar to 
	//  be dockable 
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); 
	EnableDocking(CBRS_ALIGN_ANY); 
	DockControlBar(&m_wndToolBar); 
 
	return 0; 
} 
 
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	if( !CFrameWnd::PreCreateWindow(cs) ) 
		return FALSE; 
	// TODO: Modify the Window class or styles here by modifying 
	//  the CREATESTRUCT cs 
 
	return TRUE; 
} 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame diagnostics 
 
#ifdef _DEBUG 
void CMainFrame::AssertValid() const 
{ 
	CFrameWnd::AssertValid(); 
} 
 
void CMainFrame::Dump(CDumpContext& dc) const 
{ 
	CFrameWnd::Dump(dc); 
} 
 
#endif //_DEBUG 
 
///////////////////////////////////////////////////////////////////////////// 
// CMainFrame message handlers 
 
 
void CMainFrame::xyshow(int x, int y) 
{ 
CString strsa; 
if(m_wndStatusBar){ 
	m_wndStatusBar.SetPaneText(1," "); 
	strsa.Format("x=%d",x); 
	m_wndStatusBar.SetPaneText(2,strsa); 
	strsa.Format("y=%d",y); 
	m_wndStatusBar.SetPaneText(3,strsa); 
}; 
} 
 
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)  
{ 
	// TODO: Add your message handler code here and/or call default 
if(fullscreenkey) 
{ 
lpMMI->ptMaxSize.x=mefullscreen.Width(); 
lpMMI->ptMaxSize.y=mefullscreen.Height(); 
lpMMI->ptMaxPosition.x=mefullscreen.left; 
lpMMI->ptMaxPosition.y=mefullscreen.top; 
lpMMI->ptMaxTrackSize.x=mefullscreen.Width(); 
lpMMI->ptMaxTrackSize.y=mefullscreen.Height(); 
 
} 
	 
	CFrameWnd::OnGetMinMaxInfo(lpMMI); 
}