Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

"Debug Assertion Failed" when closing application

Status
Not open for further replies.

whodaman

Programmer
May 23, 2001
60
CA
Hi, I'm pretty new at programing with Visual C++. Currently I'm trying to update a code compiled in 16 bit to 32 bit. I've read about 32 bit not supporting the "AfxRegisterVBEvent". In the last line of an insane amout of code I saw this line:

Code:
//{{AFX_VBX_REGISTER_MAP()
  UINT NEAR VBN_CLICK = AfxRegisterVBEvent("CLICK"); 
//}}AFX_VBX_REGISTER_MAP

Thus I got rid of it. But then problem occurs when I close the program and get the "Debug Assertion Failed"

I have no clue how to get rid of this error. Here is the closing FileClose() function incase it would help anyone. Thank you in advance.

Code:
void CFd4App::FileClose()
{
   	GetAppDoc()->OnCloseDocument();
   	
   	char fname[1020];
   	CString filename;
   	CStdioFile ReadFileName;

   	ReadFileName.Open( "filename.flw", CStdioFile::modeRead | CStdioFile::typeText );
   	ReadFileName.ReadString( fname, 1010 );
                       
   	for (int i = 0; fname[i] != '.'; i++);
   	i++;
   	strcpy(&fname[i],"FLW");
	fname[i+3] = '\0';
   	filename = fname;
   	ReadFileName.Close();
	if (ReadFileName.Open( fname, CStdioFile::modeRead | CStdioFile::typeText ))
   	{
   	  char header_rec[5];
   	  ReadFileName.ReadString(header_rec,4);
   	  if(atoi(header_rec) > 0)
   	  	b_ASCII = TRUE;
   	  else
   	  	b_ASCII = FALSE;
   	  ReadFileName.Close();
   	} 
	SetAppDoc( (CFd4Doc*)CWinApp::OpenDocumentFile((const char *)filename) );
}


//{{AFX_VBX_REGISTER_MAP()
//  UINT NEAR VBN_CLICK = AfxRegisterVBEvent("CLICK"); 
//}}AFX_VBX_REGISTER_MAP
 
I don't think the the FileClose() member function has anything to do with the macro AFX_VBX_REGISTER_MAP() code, except that they both happen to be in the same source code file.

Unless someone else has a better suggestion, I would suggest running the code in debug mode and get to just before it normally crashes. Then, put breakpoints at the beginning of each logical event handling function, continue, stepping through the code at each breakpoint until you reach the end of each function, then continue again until the next breakpoint, and so forth.

Perhaps you'll be able to isolate the line where the code is actually crashing.
 
when you get the assertion error click the "RETRY" and see where it actually occurs. Then look at the call stack and trace back to how you got there (if it is down in the bowels of MFC)

Matt
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top