CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    May 1999
    Location
    UK (South)
    Posts
    93

    VC6.0 App wizard generated app assertions.

    Appwizard generates a program that causes assertions.

    Apwizard was used in the following circumstances and the code generated cause assertion even
    though no additional code had been added to the project.

    MFC exe

    1) Single Document no doc/view support.
    2) No change
    3) No change
    4) No dockingtoolbar - no statusbar
    5) No change
    6) No change

    Build and execute Program.

    Error - >

    Debug Assertion Failed!
    Program C\....
    File: winocc.cpp
    Line: 331

    If you just add doc/view support then there is no problem.

    Simon Pettman.


    Research Engineer
    Goodmans Loudspeaker Ltd
    Havant, UK.
    [email protected]

  2. #2
    Join Date
    Apr 1999
    Posts
    383

    Re: VC6.0 App wizard generated app assertions.

    That's what the Doc/View framework is for!

    If you don't use the Doc/View framework, there is no code included to create the view window for the main frame, so when it tries to set focus to the view, or pass it command messages, you will get an assert because the view window doesn't exist.

    You have to create the view in the main frame yourself if you don't use Doc/View.

    Dave


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

    Re: VC6.0 App wizard generated app assertions.

    In version 6 proper code for creation of the view is generated only if you choose toolbar and/or status bar.
    It is obviously bug in ver 6.
    Add handler for WM_CREATE message, and following code inside:

    int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
    {
    if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
    return -1;
    //added code
    if (!m_wndView.Create(NULL, NULL, AFX_WS_DEFAULT_VIEW,
    CRect(0, 0, 0, 0), this, AFX_IDW_PANE_FIRST, NULL))
    {
    TRACE0("Failed to create view window\n");
    return -1;
    }
    //added code END

    return 0;
    }




    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