MFC can't load error string resources in dbcore.cpp

1.3k Views Asked by At

I have an old MFC application I've recently updated to include code that uses CDatabase to access an old MDB.

This works, but when an internal error occurs, I get an assertion in dbcore.cpp that it could not load the error string resource.

After some research, I added the following line to my application's RC file.

#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#ifndef APSTUDIO_INVOKED
#include "targetver.h"
#endif
#include "afxres.h"
#include "afxdb.rc"  // <<======= I ADDED THIS LINE HERE!!!

/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS

This solved the problem. I now got a meaningful message for internal errors. However, now if I try to save my resource file using the resource editor, I get an error.

enter image description here

How can I get meaningful internal database messages and still be able to save changes to my resource file?

1

There are 1 best solutions below

0
On BEST ANSWER

Per Joe Willcoxson's comment, moving the added line to my RC2 file solved the issue. I now have the necessary database resources, and I'm still able to edit and save resources in the resource editor.