www.pudn.com > studentScore(v6.0).rar > MainFrm.cpp, change:2003-04-20,size:2620b


// MainFrm.cpp : CMainFrame 类的实现 
// 
 
#include "stdafx.h" 
#include "StudentScore.h" 
#include "MainFrm.h" 
#include "User.h" 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#endif 
 
 
// CMainFrame 
 
IMPLEMENT_DYNAMIC(CMainFrame, CMDIFrameWnd) 
 
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd) 
	ON_WM_CREATE() 
	ON_WM_CLOSE() 
	ON_WM_ERASEBKGND() 
END_MESSAGE_MAP() 
 
static UINT indicators[] = 
{ 
	ID_SEPARATOR,           // 状态行指示器 
	ID_INDICATOR_USERNAME, 
	ID_INDICATOR_SYSTIME, 
	//ID_INDICATOR_CAPS, 
	//ID_INDICATOR_NUM, 
	//ID_INDICATOR_SCRL, 
}; 
 
 
// CMainFrame 构造/销毁 
 
CMainFrame::CMainFrame() 
{ 
	// TODO:在此添加成员初始化代码 
} 
 
CMainFrame::~CMainFrame() 
{ 
} 
 
 
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) 
{ 
	if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1) 
		return -1; 
	 
	if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP 
		| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) || 
		!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) 
	{ 
		TRACE0("未能创建工具栏\n"); 
		return -1;      // 未能创建 
	} 
 
    
	if (!m_wndStatusBar.Create(this) || 
		!m_wndStatusBar.SetIndicators(indicators, 
		  sizeof(indicators)/sizeof(UINT))) 
	{ 
		TRACE0("未能创建状态栏\n"); 
		return -1;      // 未能创建 
	} 
	// TODO: 如果不需要工具栏可停靠,则删除这三行 
 
	m_wndStatusBar.SetPaneText(1,theApp.m_pUser->m_UserName); 
	m_wndStatusBar.SetPaneText(2,theApp.m_pUser->m_LoginDate.Format("%y-%b-%d"));   
	m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY); 
	EnableDocking(CBRS_ALIGN_ANY); 
	DockControlBar(&m_wndToolBar); 
    this->SetTitle("学生信息管理系统"); 
	return 0; 
} 
 
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) 
{ 
	if( !CMDIFrameWnd::PreCreateWindow(cs) ) 
		return FALSE; 
	// TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或 
	// 样式 
     
	return TRUE; 
} 
 
 
// CMainFrame 诊断 
 
#ifdef _DEBUG 
void CMainFrame::AssertValid() const 
{ 
	CMDIFrameWnd::AssertValid(); 
} 
 
void CMainFrame::Dump(CDumpContext& dc) const 
{ 
	CMDIFrameWnd::Dump(dc); 
} 
 
#endif //_DEBUG 
 
 
// CMainFrame 消息处理程序 
 
 
void CMainFrame::OnClose() 
{ 
	// TODO: 在此添加消息处理程序代码和/或调用默认值 
  if(MessageBox("真的要退出系统吗?","退出询问",MB_OKCANCEL|MB_ICONQUESTION)==IDOK) 
	 CMDIFrameWnd::OnClose(); 
} 
 
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext) 
{ 
	// TODO: 在此添加专用代码和/或调用基类 
    
 
	return CMDIFrameWnd::OnCreateClient(lpcs, pContext); 
} 
 
BOOL CMainFrame::OnEraseBkgnd(CDC* pDC) 
{ 
	// TODO: 在此添加消息处理程序代码和/或调用默认值 
	  return TRUE; 
 
}