MDI Question
-
Colleagues, I have a quick question. I would think that the code pointed to by the arrow below would result in the IDR_MAINFRAME menu (and other resources) being displayed when the application starts. However, the IDR_PhotoOneTYPE menu and resources are loaded when the application starts. Is that because it just loads the first document template that is defined? If not, why is that? Thanks in advance for any information you provide.
AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views //CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_PhotonOneTYPE, RUNTIME_CLASS(CPhotonOneDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CPhotonOneView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // LyghtWayve Document Template //CMultiDocTemplate* pLWDocTemplate; pLWDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(CLyghtWayveDoc), RUNTIME_CLASS(CLyghtWayveFrm), RUNTIME_CLASS(CLyghtWayveView)); if(!pLWDocTemplate) return FALSE; AddDocTemplate(pLWDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) <----------<<<< return FALSE; m_pMainWnd = pMainFrame; // call DragAcceptFiles only if there's a suffix // In an MDI app, this should occur immediately after setting m_pMainWnd // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!Proce
-
Colleagues, I have a quick question. I would think that the code pointed to by the arrow below would result in the IDR_MAINFRAME menu (and other resources) being displayed when the application starts. However, the IDR_PhotoOneTYPE menu and resources are loaded when the application starts. Is that because it just loads the first document template that is defined? If not, why is that? Thanks in advance for any information you provide.
AfxEnableControlContainer(); // Standard initialization // If you are not using these features and wish to reduce the size // of your final executable, you should remove from the following // the specific initialization routines you do not need // Change the registry key under which our settings are stored // TODO: You should modify this string to be something appropriate // such as the name of your company or organization SetRegistryKey(_T("Local AppWizard-Generated Applications")); LoadStdProfileSettings(4); // Load standard INI file options (including MRU) // Register the application's document templates. Document templates // serve as the connection between documents, frame windows and views //CMultiDocTemplate* pDocTemplate; pDocTemplate = new CMultiDocTemplate(IDR_PhotonOneTYPE, RUNTIME_CLASS(CPhotonOneDoc), RUNTIME_CLASS(CChildFrame), // custom MDI child frame RUNTIME_CLASS(CPhotonOneView)); if (!pDocTemplate) return FALSE; AddDocTemplate(pDocTemplate); // LyghtWayve Document Template //CMultiDocTemplate* pLWDocTemplate; pLWDocTemplate = new CMultiDocTemplate(IDR_MAINFRAME, RUNTIME_CLASS(CLyghtWayveDoc), RUNTIME_CLASS(CLyghtWayveFrm), RUNTIME_CLASS(CLyghtWayveView)); if(!pLWDocTemplate) return FALSE; AddDocTemplate(pLWDocTemplate); // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) <----------<<<< return FALSE; m_pMainWnd = pMainFrame; // call DragAcceptFiles only if there's a suffix // In an MDI app, this should occur immediately after setting m_pMainWnd // Enable drag/drop open m_pMainWnd->DragAcceptFiles(); // Enable DDE Execute open EnableShellOpen(); RegisterShellFileTypes(TRUE); // Parse command line for standard shell commands, DDE, file open CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Dispatch commands specified on the command line. Will return FALSE if // app was launched with /RegServer, /Register, /Unregserver or /Unregister. if (!Proce
Hi, The application maintains a list(CPtrList) of document templates. When the application starts the document template availalbe at the head of the list is loaded. The AddDocTemplate adds the template to the tail of the above said list. So as per ur code... this list is like below pDocTemplate->pLWDocTemplate Bye, Cool Ju :cool: Dream Ur Destiny
-
Hi, The application maintains a list(CPtrList) of document templates. When the application starts the document template availalbe at the head of the list is loaded. The AddDocTemplate adds the template to the tail of the above said list. So as per ur code... this list is like below pDocTemplate->pLWDocTemplate Bye, Cool Ju :cool: Dream Ur Destiny
Thanks so much... So what does the following statement do: // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; Again, thanks for your answer.
-
Thanks so much... So what does the following statement do: // create main MDI Frame window CMainFrame* pMainFrame = new CMainFrame; if (!pMainFrame || !pMainFrame->LoadFrame(IDR_MAINFRAME)) return FALSE; Again, thanks for your answer.
Hi, This will be the default menu when no document is opened. try to add the below line in the InitInstance() and see the difference. Add the line cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; above this line in ur InitInstance() if (!ProcessShellCommand(cmdInfo)) return FALSE; Bye, Cool Ju :cool: Dream Ur Destiny
-
Hi, This will be the default menu when no document is opened. try to add the below line in the InitInstance() and see the difference. Add the line cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; above this line in ur InitInstance() if (!ProcessShellCommand(cmdInfo)) return FALSE; Bye, Cool Ju :cool: Dream Ur Destiny
Thank you so much. I really appreciate your answer.