Re: Debug Assertion Failed
- From: David Wilkinson <no-reply@xxxxxxxxxxxx>
- Date: Wed, 20 Dec 2006 05:44:55 -0500
Newbie & Noobie wrote:
Hi, when i create a new second form and add in FileOnPrint and FileOnPrintPreview command from the MFC classwizard. On the Constructor, i added the following code:
void CProduct::OnFilePrint() {
// TODO: Add your command handler code here
CFormView::OnFilePrint() ; // code added
}
when execute and press the print button to test whether it is working or not, I got the following error:
Debug Assertion Failed.
File: viewprnt.ccp
Line: 161
How do I remedy the problem.
Thanks.
Noob:
When you get an assertion error, make sure you are running under the debugger and look at what the assertion says. Then follow up the call stack until you get to your code, and think what you could have done to cause it.
In this case, the problem is that the printer device context is NULL, which suggests there is something wrong about how you have hooked up this view. If you look at the call stack between your code and where the assertion happens then you may see what has gone wrong.
David Wilkinson
.
- Follow-Ups:
- Re: Debug Assertion Failed
- From: Joseph M . Newcomer
- Re: Debug Assertion Failed
- Prev by Date: Re: CString and UTF-8
- Next by Date: CONTROL HWND IN DIALOG
- Previous by thread: LoadToolBar Function in Subclassed CToolBar fails.
- Next by thread: Re: Debug Assertion Failed
- Index(es):
Relevant Pages
|