Debug Assertion Failed by using CView

Hi everybody!
I'm using VisualC++6 with MFC.
I have a assert when I quit my program (SDI)

Here is the code:

I created Document templates :

CSingleDocTemplate* pDocTemplate;
pDocTemplate = new CSingleDocTemplate(
		IDR_MAINFRAME,
		RUNTIME_CLASS(CMyListViewDoc),
		RUNTIME_CLASS(CMainFrame),
		RUNTIME_CLASS(CMyView));

In my CMyView class, I've got a member variable :

protected:
CView2 m_View;

with class CView2 :

class CViewExt:public CView
{
public:
	CViewExt();
	DECLARE_DYNCREATE(CViewExt)

	virtual ~CViewExt();
	virtual void OnDraw(CDC* pDC);

};

For Creating a new view, I do in function :
int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	......						m_View.Create(NULL,"test",WS_VISIBLE,CRect(0,0,100,50),NULL,0);
	......
}

but when I quit my program, after going into the destructor of m_View : 
I have an Debug assertion failed.
File : dbgheap.c line 1044.
Expression : _CrtIsValidHeapPointer(pUserData)
In my output of VisualC++ :
HEAP[VTClient.exe]: Invalid Address specified to RtlValidateHeap( 
a80000, 38e62d8 )

There must be something I'm not doing right. Is there anyone who knows how
to properly use  views in a non doc/view architecture application?
Thanks for your help!


0
McFly269 (1)
6/7/2004 10:01:03 PM
vc.mfc 33608 articles. 0 followers. Follow

1 Replies
927 Views

Similar Articles

[PageSpeed] 34

Largely the code you show is irrelevant to the bug. You probably have a destructor on an
ininitialized variable which would have a pointer of something like 0xDFDFDFDF, which
would trigger that message. What does the stack backtrace tell you, which is far more
important.It could also mean that you have overwritten the heap in some bad way. Without
the details of the context in which this error occurs (stack backtrace, not "when I quit
my program") it is nearly impossible to guess what might be happening.
					joe

On Tue, 08 Jun 2004 00:01:03 +0200, Nikko <McFly@yahoo.fr> wrote:

>Hi everybody!
>I'm using VisualC++6 with MFC.
>I have a assert when I quit my program (SDI)
>
>Here is the code:
>
>I created Document templates :
>
>CSingleDocTemplate* pDocTemplate;
>pDocTemplate = new CSingleDocTemplate(
>		IDR_MAINFRAME,
>		RUNTIME_CLASS(CMyListViewDoc),
>		RUNTIME_CLASS(CMainFrame),
>		RUNTIME_CLASS(CMyView));
>
>In my CMyView class, I've got a member variable :
>
>protected:
>CView2 m_View;
>
>with class CView2 :
>
>class CViewExt:public CView
>{
>public:
>	CViewExt();
>	DECLARE_DYNCREATE(CViewExt)
>
>	virtual ~CViewExt();
>	virtual void OnDraw(CDC* pDC);
>
>};
>
>For Creating a new view, I do in function :
>int CMyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
>{
>	......						m_View.Create(NULL,"test",WS_VISIBLE,CRect(0,0,100,50),NULL,0);
>	......
>}
>
>but when I quit my program, after going into the destructor of m_View : 
>I have an Debug assertion failed.
>File : dbgheap.c line 1044.
>Expression : _CrtIsValidHeapPointer(pUserData)
>In my output of VisualC++ :
>HEAP[VTClient.exe]: Invalid Address specified to RtlValidateHeap( 
>a80000, 38e62d8 )
>
>There must be something I'm not doing right. Is there anyone who knows how
>to properly use  views in a non doc/view architecture application?
>Thanks for your help!
>

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)
6/8/2004 6:35:11 PM
Reply:

Similar Artilces:

How can I find out which apps are using .NET and which not?
I appear to have three versions of .NET (2, 3, 3.5) with their associated special packs. How can I find out which apps are using .NET. (Please, no 'cut-one-out' method, I do not want to uninstall and see what has stopped working.) I am aware that the different .NETS are individually and separately usable by different apps - my questions is what app uses which? Thanks for any pointers occam wrote: > I appear to have three versions of .NET (2, 3, 3.5) with their > associated special packs. > > How can I find out which apps are using .NET. (Please, no 'c...

Just setup outlook using my Yahoo, my messages disappeared in yaho
I just set up my outlook with my yahoo account, i have done this before with msn and i was still able to access my hotmail account and receive emails at both, they synced up. Now i go to yahoo and all of my messages are gone, can i get them back? What do I do? "Brooke" <Brooke@discussions.microsoft.com> wrote in message news:52C631D4-A414-4F7D-B3E6-5FE1A668F52F@microsoft.com... >I just set up my outlook with my yahoo account, i have done this before >with > msn and i was still able to access my hotmail account and receive emails > at > both, they synced ...

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....

Reading xlsx using fso -logic..
I am reading an excel spreadsheet that has data starting from line 3 and store it in Access 2007 database. It has coulmn names but they are not relavant so I want to skip them and assign a different name. There are around 250 columns so I am just trying to read a few columns to test my code. I don't wan to use transferdb as there are format issues. Ex: Age has 6 mo. as well numeric data so 6mo coming out missing. My temp_str shows all junk character any idea? Private Sub readxl() Dim fso As New FileSystemObject Dim Tst As TextStream Dim strline As String Dim...

Using cell information in formula?
Hi I want to check a program which shows data form our systems and I used a worksheet "stateview" for placing data from this program. In a database the exact data is stored and this data is put in a second worksheet. This data is a lot more, because all the data is in it. But in both worksheets the same systems should be occur. In a third worksheet I want the other two worksheets and I made a formula: =IF(ISERROR(VLOOKUP(VALUE(C2);'database'!B:C;1;FALSE));"fail database"; IF(ISERROR(VLOOKUP(VALUE(C2);stateview!F$3:F$290;1;FALSE)); "fail stateview";&quo...

Updating an existing dataset using a diffgram
It seems like this should be easy, but it has proven to be quite painful. I have an existing dataset, which I used the GetChanges and WriteXML functions upon to write out a DiffGram to a local XML file. I want to use this same dataset (in another instance of the application) and the DiffGram to display the changes in the DataGridView as they existed after the user made his/her change. In English: A user will open the application, which displays data in a grid, make their changes and hit save. This will save only the changes (in a diffgram) to a local file. They will then come in the next ...

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? ...

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 __...

What software should I use for digital scrapbooking?
Hello, I really want to start digital scrapbooking. What software do you suggest? Can I use Publisher? Thanks, Jody :o) Jody :o) wrote: > Hello, I really want to start digital scrapbooking. > What software do you suggest? Can I use Publisher? > Thanks, Jody :o) ==================================== Maybe the following site will give you some ideas: New To Digital Scrapbooking? http://tinyurl.com/9o22p -- John Inzer That was helpful. Thanks, Jody :o) "John Inzer" wrote: > Jody :o) wrote: > > Hello, I really want to start digital scrapbooking. ...

can't open .XLS files using version 7.0
I am using excel 97 v 7.0 and can't open files with extension .XLS. Not sure but they may have been created on newer version of excel Excel 7 was excel 95 I believe so you must save xls files as excel 5/95 version on the newer versions, if you are using excel 97 it has the same file format (there might be a few things later added that won't be available but the files should open) -- Regards, Peo Sjoblom (No private emails please) "Silvermarsh" <Silvermarsh@discussions.microsoft.com> wrote in message news:E50CFD42-733E-42AD-B218-782C15C31910@microsoft.com......

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...

Use right-to-left layout
When I am in the process of creating a new document in Publisher 2007 there is an option (checkbox) called "Use right-to-left layout". If I select this option then the page sorter shows page one on the right and subsequent pages to the left. Why would someone choose this? It does not seem to impact how the actual document is printed or page numbering. How can you revert back after you have created the document? Dave wrote: > Why would someone choose this? It does not seem to impact how the actual > document is printed or page numbering. In languages where you re...

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...

stop using excel for all my downloads
I need some help...my computer literacy is close to zero...I accidentally hit use excel always button when trying to download an email sent which is not what I wanted, can someone offer advice on how to get it back to 'normal' thank u and happy holidays Do you know the extension of the file you did this on? (like .doc in MyFile.doc or .txt in Example.txt) If you do, then create a new file with that name. then in windows explorer, shift-rightclick on that file You'll see an option for "Open With" find the real owner of that extension (you may need to browse for it) ...

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...

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...

Problem in replying when using word as editor
Hello, I have a problem that when I use word as the editor and I reply to a message the original message is either erased or written in garbaged symbols. This doesn't happen all the time just in certain messages. I think it is when someone sedn me the me in unicode 8 and/or the fonts are of a certain type. Can you please help me solve the problem? ...

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? ...

Change the space used for my x-axis labels
Can anybody help me? I have an column chart with words as labels. My problem is that I can't change the space used for the labels, that is some labels is in two or three lines and I would like to use more room for the labels and less room for the chart itself. But when I make the chart smaller then the labels just are dragged upwards - how do I prevent that?? ...

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 ...