高分请教:无法加载资源 in DLL

yongsinglove 2007-09-05 10:23:23
我在把一个基于对话框的程序做成一个常规的DLL时,在调用该DLL的时候出现错误,跟踪到LoadResource时,显示资源句柄为0,无法加载对话框中的资源,请问为什么,怎么解决。
给出有用的回答就给分。
...全文
244 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
opencv2013 2008-11-22
  • 打赏
  • 举报
回复
帮你修改好啦
redex 2007-09-06
  • 打赏
  • 举报
回复
mark, 帮顶!
feimingbiao 2007-09-05
  • 打赏
  • 举报
回复
写MFC Extension DLL 的常见错误。

http://msdn2.microsoft.com/EN-US/library/ba9d5yh5(VS.80).aspx

By default, MFC uses the resource handle of the main application to load the resource template. If you have an exported function in a DLL, such as one that launches a dialog box in the DLL, this template is actually stored in the DLL module. You need to switch the module state for the correct handle to be used. You can do this by adding the following code to the beginning of the function:


AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
wy2001wy 2007-09-05
  • 打赏
  • 举报
回复
一般是第一个参数给错了,多试试吧,我也记不清应该给什么了,给个NULL试试?
yongsinglove 2007-09-05
  • 打赏
  • 举报
回复
最好给出程序源代码,我的邮箱:yongsinglove@yahoo.com.cn.
急!!!!!!!!!!!!!!!!!!!!!!!!!!!
arong1234 2007-09-05
  • 打赏
  • 举报
回复
一般都是因为资源在dll中,而程序只在exe模块中找资源,使用AfxSetResourceHandle修改这个

15,471

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 进程/线程/DLL
社区管理员
  • 进程/线程/DLL社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧