GIDForums  

Go Back   GIDForums > Computer Programming Forums > MS Visual C++ / MFC Forum
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

 
 
Thread Tools Search this Thread Rate Thread
  #1  
Old 07-Dec-2004, 02:10
stanely stanely is offline
New Member
 
Join Date: Dec 2004
Posts: 2
stanely is on a distinguished road

File Serialize's problem


Hi,

I am a newbie of MFC programming. I practice an example of the book, and I typed same code of the book that the author wrote.
It's ok when I compile and build, but run it for file operation will occur error.

error message as follow:
-------------------------------------
Debug Assertion Failed!
program:c:\Documents and Settings\554\桌面\MFC\Painter\Debug\Painter.exe
File: docmgr.cpp
Line: 577
-------------------------------------

docmgr.cpp isn't mine, I think MFC provide it.
I tried set breakpoint in the Line 577 in docmgr.cpp, and debug.
VERIFY(title.LoadString(nIDSTitle)); // => Line 577

CString::LoadString() error cause VERIFY's error.
I trace the code to find someone call the function there.In the debug mode,
callback window order as follow

CDocManagerPromptFileName(CString & {""}, unsigned int 61440, unsigned long 4100, int 1, CDoctemplate * 0x00000000 {CDoctemplate}) line 577
CDocManager::OnFileOpen() line 836 + 31 bytes
CWinApp::OnFileOpen() line 37

So, it's problem of nIDSTitle. Trace again,

if (!DoPromptFileName(newName, AFX_IDS_OPENFILE,
OFN_HIDEREADONLY | OFN_FILEMUSTEXIST, true, null))
return; // open cancelled


Anyone can help me to solve this problem.

Thanks.....
  #2  
Old 07-Dec-2004, 11:07
imbtf imbtf is offline
Junior Member
 
Join Date: Aug 2004
Posts: 41
imbtf will become famous soon enough
title.LoadString(nIDSTitle) failed trying to load a resource. The bug is not likely to be in the MFC lib, but somewhere in your code. MFC is loaded with tons of ASSERT's and VERIFY's and when one of them triggers it's most likely due to an error by the programmer that it wants to alert you of.

Whatever function is being called, is it supplied with a valid resource ID? (Presumably a string ID) or just giving a random integer as input?

Look at the callstack and find where in your code the function triggering the assert is called. Alternatively you could step through your program until it asserts.
  #3  
Old 08-Dec-2004, 09:54
stanely stanely is offline
New Member
 
Join Date: Dec 2004
Posts: 2
stanely is on a distinguished road
Why?
I traced the bug about serialize(file operation), but don't obtain at all.
So I change the project settings from visual c++6, change MFC setting from "Use MFC in a static library" to "Use MFC in a shared DLL".
Then compile and build it, it can work without any problem happen!

It's funny, I don't know how to explain it.

Anyone can teach me what happened?

Thanks.....
 
 

Recent GIDBlogToyota - 2008 September Promotion by Nihal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
CD Burner Help - Power Calibration Error.... JonBoy420 Computer Hardware Forum 110 05-Feb-2008 18:34
CD burner wont burn!! robertli55 Computer Hardware Forum 1 18-Jun-2004 10:53
Yet another CD burner problem: Lite-On LSC-24082K Erwin Computer Hardware Forum 1 22-May-2004 11:28
Re: Programming Techniques WaltP C Programming Language 0 09-Mar-2004 23:56

Network Sites: GIDNetwork · GIDWebHosts · GIDSearch · Learning Journal by J de Silva, The

All times are GMT -6. The time now is 06:37.


vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.