MFC LoadString在dll中失败 [英] MFC LoadString in dll fails

查看:186
本文介绍了MFC LoadString在dll中失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个静态函数在dll中使用LoadString()从资源加载字符串。当我从该dll调用此函数一切正常。但是,当我从其他模块(activeX控件)调用此函数LoadString失败,错误ERROR_RESOURCE_NAME_NOT_FOUND。我尝试了AFX_MANAGE_STATE宏,但它没有帮助。有人知道这里可能有什么问题,解决方案是什么?

I have a static function in dll which loads string from resource using LoadString(). When I call this function from that dll everything works OK. But, when I call this function from other module (activeX control) LoadString fails with error ERROR_RESOURCE_NAME_NOT_FOUND. I tried with AFX_MANAGE_STATE macro but it didn't help. Does anybody know what could be problem here and what is the solution?

推荐答案

如果字符串在不同的dll那么你必须从其他模块设置资源句柄,使其工作。尝试使用 AfxSetResourceHandle 方法设置资源句柄。

If the string is in a resource of the different dll then you have to set the resource handle from the other module to make it work. Try to set the resource handle using AfxSetResourceHandle method.

这篇关于MFC LoadString在dll中失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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