Thread: How to get rid of MDI window

  1. #1
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401

    How to get rid of MDI window

    I created a new, basic MFC app using the AppWizard in VS .NET, and I want to get rid of the MDI window that is there when I start the application. How do I do this?
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  2. #2
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    Comment out the code that looks like this in your main application class
    // 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 (!ProcessShellCommand(cmdInfo))
    // return FALSE;
    // The main window has been initialized, so show and update it

  3. #3
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    That worked, but why? It implies that the command line parameters specify a new window, but I can't find where the parameters are specified.

    EDIT: Ok, I'm guessing the application is designed to open a new document if there are no command line parameters. The easy way out is to do what you did, but what if I actually want to use the command line? I can't just comment out those lines. Are there any other solutions to this? Perhaps I could inherit the CCommandLine class and override some of the functions. Is that a good idea?
    Last edited by bennyandthejets; 05-10-2004 at 12:25 AM.
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  4. #4
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Yep, that's a good solution. Inherit from CCommandLineInfo, and in your new constructor, change m_nShellCommand to FileNothing, like so:

    Code:
    class DisplayGraphicsCmdLine : public CCommandLineInfo
    {
    public:
    	DisplayGraphicsCmdLine() {m_nShellCommand=FileNothing; }
    };
    [email protected]
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    470
    Actually its not mine. I wanted the same effect in one of my programs that uses multiple documents and views. Since the default MFC multiple file chooser is not all that good, I figured it would be best to have my menu arranged like file->new diagram->(List of diagrams). So I searched a while for the solution online and found it somewhere. It's kind of unfortunate that the MFC code-generate doesn't specify any comments on this.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. WM_CAPTION causing CreateWindowEx() to fail.
    By Necrofear in forum Windows Programming
    Replies: 8
    Last Post: 04-06-2007, 08:23 AM
  2. 6 measly errors
    By beene in forum Game Programming
    Replies: 11
    Last Post: 11-14-2006, 11:06 AM
  3. OpenGL Window
    By Morgul in forum Game Programming
    Replies: 1
    Last Post: 05-15-2005, 12:34 PM
  4. problem with open gl engine.
    By gell10 in forum Game Programming
    Replies: 1
    Last Post: 08-21-2003, 04:10 AM
  5. opengl code not working
    By Unregistered in forum Windows Programming
    Replies: 4
    Last Post: 02-14-2002, 10:01 PM