2008年(909)
分类:
2008-05-06 21:33:58
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中对话框显示出来了:)