Debug Assertion Failed #4

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.

0
12/20/2006 2:36:00 AM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
399 Views

Similar Articles

[PageSpeed] 1

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
0
no-reply8010 (1790)
12/20/2006 10:44:55 AM
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@effisols.com> wrote:

>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
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
12/21/2006 3:29:15 PM
Reply:

Similar Artilces:

3.0 Upgrade Failed
We have recently been trying to upgrade our 1.2 installation to 3.0, but have ran into some stumbling blocks along the way. After resolving the "Invalid SQL replication data" error on the advisor we were finally able to continue on with the installation but now continuously get the below error causing a failed installation. The enviornment is as such: SQL 2000 SP4 on 2003 std CRM 1.2 on seperate 2003 std Active Directory operating in 2003 functional Any thoughts or suggestions are welcome. Thanks! Error| Install exception.System.Exception: Action Microsoft.Crm.Setup.Server....

Conditional Formatting problem #4
I would like a cell to have a background color of yellow if it is empty (ie: neeeds data input). Once it has data, the background turns off. I used two conditions in the conditional format command and it doesn't appear to be working. I used (cell value) (is equal to) then typed in 2 double quotes with no space in between for the condition "yellow" then, condition 2 (cell value) (is not equal to) then typed in the same as above for the condition "no fill" I thought it seemd simple enough and it appeared to work at first but then stopped working. How do you guy...

The Operation on the | Object failed
I have an access database linked to a SQL server 2005 back end database and my users randomly get the above message on occasions. It appears to usually happen when running VBA code. Can anybody help? ...

MS Money; MS Active 4.2; AudiVox 6700
I have Windows Mobile Version 5.0; OS 5.1.195 (Build 14847.2.0.0), and using MS ActiveSync 4.2 on a Dell Laptop - Windows XP Home OS, and have MS Money 2005. I have installed MPPC 2005 but can't sync the data from the laptop to my AudioVox 6700 device. I manually enter data to the laptop, but want to enter data when I make a purchase, then sync both devices so the laptop and 6700 on synchronized. What version of money and activesync do I need to make that happen? -- Greg Neese gregneese@gregneese.com Sorry Money will not sync with a Mobile V5 PDA/PC. -- Regards Bob Peel, Micro...

Update Fails to Load
I have tried several times to install KB979683 and keep getting failure message. All other updates load fine. Also, have Stopzilla and McAfee Virus Scan but can't seem to get rid of a malicious file that won't let me go to sites when I look up things on google, bing....always get sent to advertisement websites. Any ideas or helpful suggestions!! Thanks Always state your full Windows version (e.g., WinXP SP3; WinXP 64-bit SP2; Vista SP1; Vista 64-bit SP2; Win7; Win7 64-bit) when posting in a forum or newsgroup. Please do so in your next reply. When does your McAfee su...

Dialog and asserts
Hi, I have a dialog based application and I want to open another dialog. I have a function int CMyDialog::Execute { // CMyDialog::Execute int ret_code; CNewDialog m_NewDialog(this); ret_code = m_NewDialog.DoModal(); return ret_code; } // CMyDialog::Execute that opens this dialog but this fail :( I got at assert on this line BOOL CWnd::Attach(HWND hWndNew) { ---> ASSERT(m_hWnd == NULL); // only attach once, detach on I have realized my application with the Wizard so I am not very expert about this stuff. Can someone tell me what's happening ? Stefano Malavasi __...

Outlook Prompting 4 Passwords
Outlook started prompting for passwords even though it has always stored them (same problem with OE). The passwords seemed to just disappear & when I put them back in they would not save, even though remember password boxes were checked. I followed advice in regard to deleting the Protected Storage System Provider keys in the registry, but after I had done this Outlook & OE still don't store the passwords, despite having repeated the process a couple of times. The other problem I have is that system restore refuses to recover to a previous restore point. So do I have ...

Problem with reports (rdl) in Microsoft Dynamics CRM 4.0
Hi All, We have recently upgraded from crm3.0 to crm4.0. We are facing issue with our CRM 3.0 cutom reports (rdl ). We have already converted our SRS 2000 reports to SRS 2005 and uploaded it successfully to our reporting server as well. The problem is that those reports are not visible inside CRM 4.0. Regards, Nishant Rana You just need to add the RDL's througth the reports interface within CRM 4.0. The 3.0 to 4.0 upgrade does not support custom reports so thats why you have to add them in after the upgrade. Kind Regards Ian ...

Debug Assertion Faild
Debug Assertion Fail Program: C:..... File: winocc.cp Line: 22 The exception Breakpoin A breakpoint has been reache (0x80000003) occurred in the application at location 0x5f4369c This program is to scan a file and look for a matching string. Could this error be caused by code not exiting a "break;" properly? I'm not sure how to explore resolving this. The information listed in the Debug is The thread 0x3DD8 has exited with code 0 (0x0) The thread 0x3EA8 has exited with code -2147483645 (0x80000003) The program 'C:\Documents and Settings\Owner\My Documents\Dads\Programmi...

How to reinstall failed updates in Windows 7
How do i try to reinstall failed updates ? Seems windows update doesn't support that. I have Windows 7. Suggest you post this to the Windows 7 forum instead of the * Windows Update * newsgroup: http://social.answers.microsoft.com/Forums/en-US/w7install/threads "JamesW" wrote: > How do i try to reinstall failed updates ? > > Seems windows update doesn't support that. > > I have Windows 7. Ditto - another Win7 user here - when I follow recommendation to troubleshoot on the error code "WindowsUpdate_8020000E" appears as non...

CRM 4.0 SRS Connector Install Problem
I am trying to install MS CRM 4.0 (New install, not upgrade). My environment is setup like this: Srv-1 - Windows 2003R2 SP2, CRM Srv-2 - Windows 2003R2 SP2, SQL2005 SP2 & SQL2005 Reporting services I have installed CRM on srv-1. I am trying to install the SRS Connector on srv-2. My SQL server is a named instance (srv-2\SQL2005). I access reporting services with http://srv-2/ReportingService2005. When I try to install the SRS Connector it fails with "Unable to validate SQL Server Reporting Services Report Server installation. Please check that it is correctly installed on t...

Onsite offers for MS CRM/ +3yrs/dubai #4
Hello from STALWART INFORMATION, job opening :MS CRM in Dubai, Exp: +3 yrs, Notice period : 15days, or as soon as posible, No salary containt reference are also welcome mail us stalwartinfo@gmail.com, stalwartfback@gmail.com ...

OWA Fails to Load
Two OWA environments are failing with the same behavior. 1) The first environment is Windows NT 4 SP6a running Exchange 5.5 SP4. OWA is hosted on seperate NT box running IIS. IIS box must be restarted to temporarilly solve problem. Works for a day or so then main OWA page fails to talk to Exchange box after login and simply hangs with no erors, or gives an ASP error, but nothing in eventlogs. Cannot restart WWW service on IIS box. 2) Second environment is Windows 2000 SP4 running Exchange 5.5 SP4 and IIS on the same box. Same behavior as first environment. OWA hangs after login and does...

DEBUG
Curious, new problem has started. Evey once in a whle a new folder appears on my desktop labeled "debug"..The folder is empty and I do not know how it is formed or why..Does someone know the cause of this and a remedy so it does not appear again Thanks Running Xp professtional heshie wrote: > Curious, new problem has started. Evey once in a whle a new folder appears on > my desktop labeled "debug"..The folder is empty and I do not know how it is > formed or why..Does someone know the cause of this and a remedy so it does > not appear again &g...

When the VBA Project is locked the Save As Method fails in Excel
I cannot find a resolution. I already have the VB Code secure (the VBA Project is locked). When the Project is locked the Save As Method fails. If the VBA Project is not locked, the Save As Method works successfully. I cannot seem to find anything that addresses that situation. Do I need to get a digital signature? Do you think that will fix the problem? ...

An application crashes only under debugging
Hi, I'm using VC++ 6.0. I have a Win32 Application (I will call it "EXE") which is linked with a Win32 DLL and I don't have the source files of the DLL; When I execute the EXE by double-clicking on the icon reprsenting it , there are no problems; On the contrary, if I try to debug the EXE the program crashes: in fact, the debugger shows an "Access Violation" error message and informs that an istruction of the DLL attempts to read a memory location which cannot be read. Does someone know a possible cause of this problem? Thanks. M If the DLL is an MFC DLL (it is...

Portfolio Manger Fails
I see where others have a similar problem, but have read no solution. After "upgrading" from Money2004 to Money2005, the portfolio manager pages shows a blank screen. No investment information whatsoever. Any ideas on a work around.... In microsoft.public.money, brawn wrote: >I see where others have a similar problem, but have read no solution. After >"upgrading" from Money2004 to Money2005, the portfolio manager pages shows a >blank screen. No investment information whatsoever. Any ideas on a work >around.... Does Help->About show version 14.0...

Weird: CRichEditCtrl scrollbars work in debug build but not in release build
Hi, I have an App Wizard project (VS 6.0), non doc-view architecture. My view class is: class CRichTextView : public CRichEditCtrl. In MainFrm.cpp I have a member variable of: CRichTextView m_wndView;. I create the view as follows: if (!m_wndView.Create(WS_CHILD | WS_VISIBLE | ES_AUTOVSCROLL | ES_MULTILINE | WS_VSCROLL, CRect(0,0,0,0), this, AFX_IDW_PANE_FIRST)) { TRACE0("Failed to create view window\n"); return -1; } It works "just peachy" in the debug build. But, when I make...

Authentication failed because Entourage doesn't support any of the available authentication methods. 04-13-10
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel Email Client: pop Out of a sudden, i can't send out email and received the above error message. <br><br>For incoming email, i've no problem receiving. <br><br>I've not done any changes in my email account setting. <br><br>Anyone encountered the same problem? Please assist and advice. <br><br>Thanks ...

Installation of KB982311 Failed
Running current Windows XP Pro SP3 system with Office 2002. Attempted install of latest June 2nd Tuesday updates and KB982311 failed to install. I have the same problem when the system tries to autoupdate KB982311. The error code is 0x80070643 - and the system keeps trying to install this particular update. I am running Windows XP SP3. All other updates from june 11th 2010 installed without problems - only this one failed. I don't have a genuine Microsoft Office 2003 installation - only the free Office Viewers from Microsoft - maye that's the reason, though it has ...

Debug in Release mode?
Old wine in old bottle.. being served by a new bartender :o) How do I do this? pointer would be much appreciated. >Old wine in old bottle.. being served by a new bartender :o) > >How do I do this? The subject or the content? To debug a release build see "How to: Debug a Release Build" in your VC++ help. Dave In addition to what Dave suggested you might want to just do a find on this newsgroup using those keywords. There have been several discussions on that topic in the last few days that should pop up a bunch of links. If you can't find them let me know and ...

Password Protection #4
I have a password protected sheet. For one of the columns, I have a validation rule and have a list of values that the column can take. I put a password for the sheet and now no can change the sheet except for the column where I have the validation rule. When I click on that column, the small arrow appears and the drop down box appears and I can select a different value and change the cell. All other columns are locked. Cant we protect a column that has a validation rule with a "List" as option? Not that I'm aware. But doesn't the Data|Validation provide the sa...

blank cells #4
How do I copy and paste...and OMIT blank cells.. Larry Hi Try this: Select the range of data, click Edit>Goto>Special and select Contants; non-blank cells will be selected this way. Next, carry out normal copy and paste procedures. >-----Original Message----- >How do I copy and paste...and OMIT blank cells.. > >Larry >. > ...

CRM 4.0 Workflow Error
Hi All, I need help tracking down why a workflow is reporting a 'Bad Request' error. The workflow works ok, on a VPC with standard install of V4.0, but when I try the same workflow in the test environment I get the Bad Request error. The only difference is that the test env is IFD. Even a simple on-demand workflow that inactivates an account gives the same error in the test env. Any clues to what I can start to look at to find the cause ? Thanks, Anne ...

Very strange debugging problem
I have a windows console program that interfaces with a library that interfaces with a hardware device. I run the same unmodified program with the same input and get different results on different trials. My program is the same, the test data is the same, yet different runs produce different results. There are only two sorts of things that I can think of that could cause this: (1) The state of the hardware device changes between runs. (2) Some really weird memory error that causes my program to run correctly 75% of this time and fail other times. Does anyone have any ideas on how I ca...