分类: C/C++
2008-03-14 15:09:33
extern "C" __declspec(dllexport) void Show() { AFX_MANAGE_STATE(AfxGetStaticModuleState()); CTest test; test.DoModal (); }别忘了在文件中添加: #include "Test.h":),大功告成,编译吧!
typedef void (WINAPI * TESTDLL)(); HINSTANCE hmod; hmod = ::LoadLibrary ("mfcdll.dll"); if(hmod==NULL) { AfxMessageBox("Fail"); } TESTDLL lpproc; lpproc = (TESTDLL)GetProcAddress (hmod,"Show"); if(lpproc!=(TESTDLL)NULL) (*lpproc)(); FreeLibrary(hmod);6、试试看,是不是DLL中对话框显示出来了:)