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

    OnCloseDocument + OnFileNew causes assert failure

    Hello all
    This has got to be something stupid I'm missing but I hope someone out there would be kind enough to show me what it is :
    I have an MDI project where the App class handles the OnFileOpen command. What I want is for it to close all open windows (views) + docs (actually I allow only one open Doc but thats beside the point) and only then, go into the CWinApp::OnFileOpen. I rigged my OnFileOpen as such :

    CMDIChildWnd *pChild = ((CMainFrame *)AfxGetMainWnd())->
    MDIGetActive();

    if (pChild)
    {
    COdinDoc * pDoc = ((COdinDoc *)pChild->
    GetActiveDocument());
    if (pDoc)
    pDoc->OnCloseDocument();
    }

    CWinApp::OnFileOpen();



    And I have the following annoying problem : The doc + it's view do get closed BUT, once into CWinApp::OnFileOpen() I get an assert failure. This does not happen if I use the File menu "Close" option and then open a file manually (file Open option)
    Anybody has any ideas ? Please let me know caus it's driving me crazy !
    ThanX
    Frost



  2. #2
    Join Date
    May 1999
    Location
    ALABAMA, USA
    Posts
    9,917

    Re: OnCloseDocument + OnFileNew causes assert failure

    I have tried your code and it works, so it must be something else...
    If you want you can zip source code, e-mail it to me and i will take a look at it. Maybe I will be able to find something...

    John Cz
    There are only 10 types of people in the world:
    Those who understand binary and those who do not.

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