Click to See Complete Forum and Search --> : VC6.0 App wizard generated app assertions.


Simon Pettman
April 14th, 1999, 02:45 AM
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.
pettman.s@gll.co.uk

Dave Lorde
April 14th, 1999, 04:58 AM
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

JohnCz
June 1st, 1999, 02:11 PM
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