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

随声附和 提交于 2020-01-07 02:22:26

问题


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.

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


回答1:


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.



来源:https://stackoverflow.com/questions/41214600/mfc-cant-load-error-string-resources-in-dbcore-cpp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!