Reputation: 21001
I used Visual Studio's Application Wizard to create a skeleton MFC program with a multi-document interface. When I start this program, it automatically creates a child frame, which I don't want it to do - I need the main frame's client area to be empty until the user chooses to open a file.
The debugger tells me that a CChildFrame object is created when the application class's InitInstance() function calls ProcessShellCommand(), but what is a good entry point for me to override this behaviour?
Upvotes: 2
Views: 3919
Reputation: 11
Do one thing..
in your XXXApp.cpp file
in this Method:-
comment the following line.. /*
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;
*/
like this....
Upvotes: 1
Reputation: 2289
This works, it maintains printing/opening from the shell etc.
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
if ( cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew )
{
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing ;
}
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;
Upvotes: 6
Reputation: 21888
Skipping the ProcessShellCommand() call (in case of FileNew) in InitInstance() is indeed the way to go.
Upvotes: 1
Reputation: 3151
This worked for me -- change
if (!ProcessShellCommand(cmdInfo))
to
if (cmdInfo.m_nShellCommand != CCommandLineInfo::FileNew && !ProcessShellCommand(cmdInfo))
in your app's InitInstance() function.
Upvotes: 4