您的位置:首页 > 其它

写DLL引起与主程序资源冲突的解决方法

2011-07-30 16:27 441 查看
class的声明里要加AFX_CLASS_EXPORT

CLightResultDlg::CLightResultDlg(CWnd* pParent, UINT nType) {EnableAutomation();HMODULE hDLL = GetModuleHandle(_T("VisDll.dll"));HINSTANCE hEXE = AfxGetResourceHandle();AfxSetResourceHandle((HINSTANCE)hDLL);BOOL bCreated = CDialog::Create(IDD_CANOPYMODEL_VIS_DLG,
pParent );if ( !bCreated ){AfxMessageBox( _T("创建面板失败,资源共享问题。"));}SUCCEEDED(bCreated);AfxSetResourceHandle(hEXE); }

调用时:

if ( !m_LightResultDlg ){m_LightResultDlg = new CLightResultDlg( this , 1 );m_LightResultDlg->ShowWindow(SW_SHOW);}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐