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);}