Click to See Complete Forum and Search --> : How to prevent document creation when MDI app starts


October 21st, 1999, 10:01 AM
Hi,

It's been a while since I've done this and it seems that MFC has now hidden this functionality. When an MDI app starts, by default, it also opens up an empty document. How does one prevent the empty document from being created?

Thanks,

Paul...

Roger Allen
October 21st, 1999, 10:14 AM
The document gets created in the call :

if (!ProcessShellCommand(cmdInfo))
return FALSE ;




in the init instance of you App class. The only way I could get around this was to comment out these two lines, but then I didn't look into it too deeply.


Roger Allen
Q2 - [CB]RIGamortis
ICQ - 31764540

October 21st, 1999, 10:35 AM
Hi Roger,

Thanks this will work. It's not an application that can use command lines
or shell type parameters.

Thanks,

Paul...

xyjiang
October 28th, 1999, 12:07 AM
In InitInstance(), you can find

CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);




Replace it with

CCommandLineInfo cmdInfo;
cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
ParseCommandLine(cmdInfo);