CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Guest

    How to prevent document creation when MDI app starts

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


  2. #2
    Join Date
    May 1999
    Location
    West Sussex, England
    Posts
    1,939

    Re: How to prevent document creation when MDI app starts

    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
    Please use meaningful question titles - "Help me" does not let me know whether I can help with your question, and I am unlikely to bother reading it.
    Please remember to rate useful answers. It lets us know when a question has been answered.

  3. #3
    Guest

    Re: How to prevent document creation when MDI app starts

    Hi Roger,

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

    Thanks,

    Paul...


  4. #4
    Join Date
    May 1999
    Posts
    34

    Re: How to prevent document creation when MDI app starts

    In InitInstance(), you can find

    CCommandLineInfo cmdInfo;
    ParseCommandLine(cmdInfo);




    Replace it with

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





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