Re: Debug Assertion Failed
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Thu, 21 Dec 2006 10:29:15 -0500
Actually, it says in the comments "Did you remember to call DoPreparePrinting". I would
suspect this is a dead giveaway as to what is wrong!
Trust The Source, Luke!
(And that means learn what that [Retry] button means, which is carefully explained in the
message...)
joe
On Wed, 20 Dec 2006 05:44:55 -0500, David Wilkinson <no-reply@xxxxxxxxxxxx> wrote:
Newbie & Noobie wrote:Joseph M. Newcomer [MVP]
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
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.
- References:
- Re: Debug Assertion Failed
- From: David Wilkinson
- Re: Debug Assertion Failed
- Prev by Date: Re: why and how to create resource dll in MFC?
- Next by Date: Re: Treecontrol with checkbox
- Previous by thread: Re: Debug Assertion Failed
- Next by thread: CONTROL HWND IN DIALOG
- Index(es):
Relevant Pages
|