Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Toolkit Pro
  New Posts New Posts RSS Feed - Debug Assertion Failed!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Debug Assertion Failed!

 Post Reply Post Reply
Author
Message
tomay3000 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2010
Location: Algeria
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomay3000 Quote  Post ReplyReply Direct Link To This Post Topic: Debug Assertion Failed!
    Posted: 20 December 2010 at 6:35pm
When I use MFC as Statically Linked Library, a Debug Assertion Failure message box containing the following code in my app::InitInstance appears:

generated debug assertion
if (!ProcessShellCommand(cmdInfo))
return FALSE;
-- File: docsingl.cpp
Line: 215


However when using MFC as Shared DLL, this error is not coming and I'll get my window.
I am confused to figure out why !?

I have traced out that my program is failing at the big line of the following code:

void CSingleDocTemplate::SetDefaultTitle(CDocument* pDocument)
{
    CString strDocName;
    if (!GetDocString(strDocName, CDocTemplate::docName) ||
        strDocName.IsEmpty())
    {
              // use generic 'untitled'
                VERIFY(strDocName.LoadString(AFX_IDS_UNTITLED));
    }
    pDocument->SetTitle(strDocName);
}


If I use the AFX_IDS_UNTITLED in the resource string table & everything goes fine.

I don't want to do this.
Even if you don't use it in the string table, it should have worked fine. because AFX_IDS_UNTITLED is defined in afxres.h & the resource file uses this header file.

Other projects that do not use AFX_IDS_UNTITLED in the string table resource are working fine.

So I opened the compiled EXE file with a Resource Editor, I searched for the missing string. I found that is was right there: "sans nom" in FRENCH cause I build my project with FRENCH AppWizard.

I recreated my project using the ENGLISH, DEUTCH, SPANISH & ITALIC AppWizard, & figured out that the problem has gone.

& I thought that the problem is due to my system: "Windows XP Pro SP3 FRENCH Edition",  so I reinstalled the system that time: "Windows XP Pro SP3 ENGLISH Edition", & figured out that all the problems has gone, & all the projects created using the ENGLISH, FRENCH, DEUTCH, SPANISH & ITALIC AppWizard are working perfectly.

The problem is that I don't want to install "Windows XP Pro SP3 ENGLISH Edition".

Any ideas? Help me Please Cry
Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit)

Language: Microsoft Visual C++ v6.0 (MFC)
Back to Top
Oleg View Drop Down
Admin Group
Admin Group


Joined: 21 May 2003
Location: United States
Status: Offline
Points: 11234
Post Options Post Options   Thanks (0) Thanks(0)   Quote Oleg Quote  Post ReplyReply Direct Link To This Post Posted: 21 December 2010 at 4:50am
Standard thing. If you compile statically you must add MFC/Toolkit resources to your resources

open res\[app].rc2 file and add line

#include "AFXRES.RC"
Oleg, Support Team
CODEJOCK SOFTWARE SOLUTIONS
Back to Top
tomay3000 View Drop Down
Groupie
Groupie
Avatar

Joined: 08 December 2010
Location: Algeria
Status: Offline
Points: 56
Post Options Post Options   Thanks (0) Thanks(0)   Quote tomay3000 Quote  Post ReplyReply Direct Link To This Post Posted: 26 December 2010 at 1:57pm
Originally posted by oleg oleg wrote:

Standard thing. If you compile statically you must add MFC/Toolkit resources to your resources

open res\[app].rc2 file and add line

#include "AFXRES.RC"


The "afxres.rc" file is already included. Thank you for your help, but I found the solution:

Debug Assertion Failed! - Solved

I did many tests to reach to this solution. So what did I do!?

I created a sample SDI application & named it as FR using the Xtreme ToolkitPro 2009 (13.4.2) AppWizard & I choosed the French (France) (APPWZFRA.DLL) to include French resources, & link the MFC statically. When the project is created, I built it to create the executable file.

In the project directory you should see the Debug or the Release folder, depending on your project configuration. Enter that folder, & now you should see an .res file. In my case it's FR.res.

I am using Restorator 2007 as my default Resource Editor. So I opened FR.res file using it, & I searched for the string "sans nom" which means "Untitled" in English. I found it in the English (United States) String resources as you see in the image below. But that string & all other French strings should be in the French (France) String resources!!! That’s strange!


Now open the .rc file from the main project directory with a text editor. In my case it's FR.rc. & scroll to the end of page, you should see this part of code:
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//

#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE 12, 1
#pragma code_page(1252)
#endif //_WIN32
#include "res\\FR.rc2"  // non-Microsoft Visual C++ edited resources <------------------------------ This is our nightmare :(
#include "l.fra\\afxres.rc"      // Standard components
#include "l.fra\\afxprint.rc"  // printing/print preview resources
#endif

#endif    // not APSTUDIO_INVOKED


The line:
#include "res\\FR.rc2"  // non-Microsoft Visual C++ edited resources

Should be moved to the end as follows:
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//

#define _AFX_NO_SPLITTER_RESOURCES
#define _AFX_NO_OLE_RESOURCES
#define _AFX_NO_TRACKER_RESOURCES
#define _AFX_NO_PROPERTY_RESOURCES

#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA)
#ifdef _WIN32
LANGUAGE 12, 1
#pragma code_page(1252)
#endif //_WIN32
#include "l.fra\\afxres.rc"      // Standard components
#include "l.fra\\afxprint.rc"  // printing/print preview resources
#include "res\\FR.rc2"  // non-Microsoft Visual C++ edited resources <------------------------------ No nightmares anymore ;)
#endif

#endif    // not APSTUDIO_INVOKED


This is because, if we open the file FR.rc2 from the res folder, we should see this code:
//
// FR.RC2 - resources Microsoft Visual C++ does not edit directly
//

#ifdef APSTUDIO_INVOKED
    #error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED

#include <XTToolkitPro.rc> <------------------------------ Xtreme ToolkitPro 2009 (13.4.2) English (United States) resources are included first :(

/////////////////////////////////////////////////////////////////////////////
// Add manually edited resources here...

/////////////////////////////////////////////////////////////////////////////

& the rest of resources inclusion will be appended to the English (United States) resources.

Now save the edited FR.rc file & rebuild your project. Then, open again FR.res file with an Resource Editor. Search for the string "sans nom". Now it should be in the French (France) String resources as shown in the image below.


That's all. & I hope that you have understood, sorry for my bad English ;)

Product: Codejock ToolkitPro MFC v16.2.0
Platform: Microsoft Windows 8 Pro (64-bit)

Language: Microsoft Visual C++ v6.0 (MFC)
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.156 seconds.