Let the dialog support the use of multi-document

zhaozj2021-02-08  250

BOOL CApp :: InitInstance () {/// m_pDocTemplate = new CMultiDocTemplate (IDR_MSG, // user define RUNTIME_CLASS (MessageDoc), RUNTIME_CLASS (MessageFrame), // main SDI frame window RUNTIME_CLASS (MessageView)); AddDocTemplate (m_pDocTemplate); / / Enable Dde Execute Open EnableShellopen (); RegistershellFiletypes (TRUE); // Parse Command Line for Standard Shell Commands, DDE, File Open CCommandlineinfo Cmdinfo; ParseCommandLine (cmdinfo); // ............ ......... ............} // ........ public: cmultidoCtemplate * m_pdoctemplate; // ........ ... // response function buttons such as void CApp :: OnManageMessage () {ASSERT (m_pDocTemplate = NULL!); CDocument * pDoc = NULL; CFrameWnd * pFrame = NULL; pDoc = m_pDocTemplate-> CreateNewDocument (); if (pDoc! = Null) {pframe = m_pdocrame (pdoc, null); if (pframe! = Null) {m_pdoctemplate-> setdefaultTitle (PDOC); if (! Pdoc-> onnewDocument ()) {PFrame-> DestroyWindow (); pFrame = NULL;} else m_pDocTemplate-> InitialUpdateFrame (pFrame, pDoc, TRUE);} else delete pDoc;} if (pFrame == NULL || pDoc == NULL) AfxMessageBox (AFX_IDP_FAILED_TO_CREATE_DOC); Else .............}

转载请注明原文地址:https://www.9cbs.com/read-2599.html

New Post(0)