Click to See Complete Forum and Search --> : How to start an MDI empty?


ric
May 14th, 1999, 03:14 AM
I do not want, when I start my MDI program, a Child Window to be created and displayed. I have trace it but I cannot find what to modify or delete.

Any idea is appreciated

Thanks

Jason Teagle
May 14th, 1999, 03:54 AM
Put the following 'if' block:

---

if (cmdInfo.m_nShellCommand != CCommandLineInfo::FileNew)
{
.
.
.
}



---

around the existing code lines:

---

// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;



---

in your app's InitInstance() method (that way, if the command line is blank (which is changed to FileNew), then the command will NOT get processed).

How's that?

Xiaojian Liu
May 14th, 1999, 05:29 AM
Replace

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);


// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;


with this

// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);

// no empty document window on startup before clicking the File New (XL)
if (cmdInfo.m_nShellCommand == CCommandLineInfo::FileNew) {
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
}
// Dispatch commands specified on the command line
if (!ProcessShellCommand(cmdInfo))
return FALSE;

in BOOL CyourApp::InitInstance().

It works for MDI.

Jason Teagle
May 14th, 1999, 05:59 AM
I knew there was slightly different way, but CCmdLineInfo::FileNothing is not listed in the help with VC++ V4.0, so I couldn't remember it and didn't trust my memory; but I think the other way also works OK, since if /p or a filename are specified on the command line then CCmdLineInfo::m_nShellCommand will NOT be CCmdLineInfo::FileNew and so ProcessShellCommand() WILL get executed in that situation.

Thanks for the reminder, though.