Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. MDI Question

MDI Question

Scheduled Pinned Locked Moved C / C++ / MFC
questionwpfwindows-adminlinux
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BlitzPackage
    wrote on last edited by
    #1

    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

    C 1 Reply Last reply
    0
    • B BlitzPackage

      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

      C Offline
      C Offline
      Cool Ju
      wrote on last edited by
      #2

      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

      B 1 Reply Last reply
      0
      • C Cool Ju

        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

        B Offline
        B Offline
        BlitzPackage
        wrote on last edited by
        #3

        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.

        C 1 Reply Last reply
        0
        • B BlitzPackage

          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.

          C Offline
          C Offline
          Cool Ju
          wrote on last edited by
          #4

          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

          B 1 Reply Last reply
          0
          • C Cool Ju

            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

            B Offline
            B Offline
            BlitzPackage
            wrote on last edited by
            #5

            Thank you so much. I really appreciate your answer.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups