CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 1999
    Posts
    306

    How to start an MDI empty?

    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


  2. #2
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: How to start an MDI empty?

    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?



    --
    Jason Teagle
    [email protected]

  3. #3
    Join Date
    May 1999
    Posts
    22

    Re: How to start an MDI empty?

    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.


  4. #4
    Join Date
    May 1999
    Location
    Farnborough, Hants, England
    Posts
    710

    Re: How to start an MDI empty?

    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.

    --
    Jason Teagle
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured