a problem about dll
-
I have written a dll,codes as below: void __declspec(dllexport) __stdcall TestDialog(HWND hWnd) { AFX_MANAGE_STATE(AfxGetStaticModuleState()); AfxSetResourceHandle(theApp.m_hInstance); AfxEnableControlContainer(); CTestDlg dlg; dlg.DoModal(); AfxSetResourceHandle(AfxGetInstanceHandle()); } void TestHello(HWND hWnd) { hMainDlg=hWnd; MessageBox(hMainDlg,"Hello","Test",MB_OK); } µ÷Ó㺠typedef void (*TestHello)(HWND); TestHello t=NULL; HINSTANCE hin=LoadLibrary("Test.dll"); if(NULL == hin) return ; t=(TestHello)GetProcAddress(hin,"TestHello"); if(NULL == t) return; t(m_hWnd); FreeLibrary(hin); typedef void (__stdcall *TestDlg)(HWND); hin=LoadLibrary("TestHello.dll"); if(NULL == hin) return ; TestDlg t1=(TestDlg)GetProcAddress(hin,"TestDialog"); if(NULL == t1) return; t1(m_hWnd); FreeLibrary(hin); both the dll and exe are ok,but if I change typedef void (*TestHello)(HWND); into typedef void (__stdcall*TestHello)(HWND); Error happens in EXE,correspondingly. typedef void (__stdcall *TestDlg)(HWND); into typedef void (*TestDlg)(HWND); EXE also has a error