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 problem

MDI problem

Scheduled Pinned Locked Moved C / C++ / MFC
questionhelp
5 Posts 3 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.
  • A Offline
    A Offline
    Aint
    wrote on last edited by
    #1

    Hi. Im doing a MDI program using CFormView. When I first run the program, there is a child window in the parent window. I do not want to open up the program with a child window. I want to see the child window only when I click File->Open. How do I do that? Thanks.

    A B 2 Replies Last reply
    0
    • A Aint

      Hi. Im doing a MDI program using CFormView. When I first run the program, there is a child window in the parent window. I do not want to open up the program with a child window. I want to see the child window only when I click File->Open. How do I do that? Thanks.

      A Offline
      A Offline
      Arman S
      wrote on last edited by
      #2

      Place the following code between ParseCommandLine and ProcessShellCommand function calls in your CMyApp::InitInstance method; if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) { cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing; }

      -- ===== Arman

      1 Reply Last reply
      0
      • A Aint

        Hi. Im doing a MDI program using CFormView. When I first run the program, there is a child window in the parent window. I do not want to open up the program with a child window. I want to see the child window only when I click File->Open. How do I do that? Thanks.

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

        BOOL CYourApp::InitInstance() { //... CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Added to prevent New Empty Document at startup if (cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew) { cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing; } //... }

        A 1 Reply Last reply
        0
        • B bob16972

          BOOL CYourApp::InitInstance() { //... CCommandLineInfo cmdInfo; ParseCommandLine(cmdInfo); // Added to prevent New Empty Document at startup if (cmdInfo.m_nShellCommand==CCommandLineInfo::FileNew) { cmdInfo.m_nShellCommand=CCommandLineInfo::FileNothing; } //... }

          A Offline
          A Offline
          Aint
          wrote on last edited by
          #4

          Hey. Thanks. But now, if I clicked File->Open, it wont display the child window. Only if I clicked File->New, will the child window be displayed. How can I make the child window be displayed when I clicked File->Open? And also, after I get the child window to be displayed through File->New, when I tried to maximize the window, my GUI is not there anymore. Why is that so?

          B 1 Reply Last reply
          0
          • A Aint

            Hey. Thanks. But now, if I clicked File->Open, it wont display the child window. Only if I clicked File->New, will the child window be displayed. How can I make the child window be displayed when I clicked File->Open? And also, after I get the child window to be displayed through File->New, when I tried to maximize the window, my GUI is not there anymore. Why is that so?

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

            ReturnRain wrote:

            it wont display the child window

            The code provided is pretty much an industry standard way in MFC to prevent the initial document in an MDI application. It appears in many articles and books. It should not have any effect on on the operations you are describing so my best guess is that you have code elsewhere that effects the actions you are having difficulty with. One way to verify this is to create a MFC MDI application using CFormView and dropping that snippet into the appropriate spot and running it without any other code added and you should see that the open and new and child maximize work correctly (at least on VC++ 6.0 and VC++ 2003). I don't use VC++ 2005 so I have no way to verify it using that IDE.

            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