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?
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
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
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
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
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.