// ChildFrm.cpp : CChildFrame 类的实现 // #include "stdafx.h" #include "IDE.h" #include "ChildFrm.h" #include ".\childfrm.h" #include "MainFrm.h" #include "IDEView.h" #ifdef _DEBUG #define new DEBUG_NEW #endif // CChildFrame IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWnd) BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd) ON_WM_CLOSE() ON_WM_CREATE() END_MESSAGE_MAP() // CChildFrame 构造/析构 CChildFrame::CChildFrame() { // TODO: 在此添加成员初始化代码 m_bClose = FALSE; m_strPath = ""; } CChildFrame::~CChildFrame() { } BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: 在此处通过修改 CREATESTRUCT cs 来修改窗口类或样式 if( !CMDIChildWnd::PreCreateWindow(cs) ) return FALSE; if (g_bStartRun) cs.style&=~WS_CAPTION; return TRUE; } // CChildFrame 诊断 #ifdef _DEBUG void CChildFrame::AssertValid() const { CMDIChildWnd::AssertValid(); } void CChildFrame::Dump(CDumpContext& dc) const { CMDIChildWnd::Dump(dc); } #endif //_DEBUG // CChildFrame 消息处理程序 void CChildFrame::OnClose() { // TODO: 在此添加消息处理程序代码和/或调用默认值 CMainFrame *pMainFrm=(CMainFrame*)AfxGetApp()->m_pMainWnd; if( pMainFrm->m_nViewCount == 1 && pMainFrm->m_bShutdown == FALSE ) { MessageBox(g_strCannotLoseAllForm,g_strTip,MB_ICONWARNING); return; } if( ((CIDEView *)pMainFrm->m_pActiveView)->m_bModified==1 ) { if(MessageBox(g_strSaveModify,g_strSelect,MB_YESNO|MB_ICONQUESTION) == IDYES) ((CIDEView *)pMainFrm->m_pActiveView)->FileSave(); } pMainFrm->m_pActiveView = NULL; pMainFrm->MDINext(); CMDIChildWnd* m_ChildFrame = (CChildFrame*)pMainFrm->GetActiveFrame(); if( m_ChildFrame != NULL ) { pMainFrm->m_pActiveView = (CFormView *)pMainFrm->GetActiveFrame()->GetActiveView(); //pMainFrm->m_pActiveView->Invalidate(); } m_bClose = TRUE; int nIndex = pMainFrm->GetIDEViewIndex(m_strPath); pMainFrm->m_nViewCount--; CMDIChildWnd::OnClose(); if( nIndex != -1 ) { //delete pMainFrm->m_pViewIDE[nIndex]; pMainFrm->m_pViewIDE[nIndex] = NULL; } } int CChildFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { //MDIMaximize( ); if (CMDIChildWnd::OnCreate(lpCreateStruct) == -1) return -1; // TODO: 在此添加您专用的创建代码 SetWindowText( m_strDesc ); return 0; }