MFC 无法在 dbcore.cpp 中加载错误字符串资源 [英] MFC can't load error string resources in dbcore.cpp

查看:32
本文介绍了MFC 无法在 dbcore.cpp 中加载错误字符串资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近更新了一个旧的 MFC 应用程序,其中包含使用 CDatabase 访问旧 MDB 的代码.

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

这可行,但是当发生内部错误时,我在 dbcore.cpp 中得到一个断言,表明它无法加载错误字符串资源.

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

经过一番研究,我在应用程序的 RC 文件中添加了以下行.

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?

推荐答案

根据 Joe Willcoxson 的评论,将添加的行移至我的 RC2 文件解决了该问题.我现在拥有了必要的数据库资源,我仍然可以在资源编辑器中编辑和保存资源.

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.

这篇关于MFC 无法在 dbcore.cpp 中加载错误字符串资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆