I don't think it's in DoModal. The program will show the dialog, but after returning and making a call to SetResourceHandle I get e run time error that says the stack around aDlg has been corrupted. The calling program and class header are below.
Code:
#define APIDLL _declspec(dllimport)

// aDialog dialog

class CModTest2Dlg: public CDialog
{

public:
	APIDLL CModTest2Dlg(CWnd* pParent = NULL);   // standard constructor
	APIDLL int DoModal();

};

int CModTest2Dlg::DoModal()
{
	CDialog::DoModal();
	return(0);
}
void CImportClassDlg::OnBnClickedBtnTest()
{
	CModTest2Dlg aDlg;
	// TODO: Add your control notification handler code here
		HINSTANCE hClientResources = AfxGetResourceHandle();
	AfxSetResourceHandle(::GetModuleHandle("MxModSim.dll"));
	aDlg.DoModal();

	AfxSetResourceHandle(hClientResources);
}

Last edited by shabbir; 3Dec2007 at 17:39.. Reason: Code block