VC写的DLL对话框界面,里面加了几个IE控件,怎么调用不成功啊
这是调用的程序:
void CTestDlg::OnButton1()
{
// TODO: Add your control notification handler code here
typedef void (WINAPI * TESTDLL)();
HINSTANCE hmod;
hmod = ::LoadLibrary ("11.dll");
//hmod = ::LoadLibrary ("Yc.HuangXiao.FrameWork.WebControls.dll");
if(hmod==NULL)
{
AfxMessageBox("Fail");
}
TESTDLL lpproc;
lpproc = (TESTDLL)GetProcAddress (hmod,"Show");
if(lpproc!=(TESTDLL)NULL)
(*lpproc)();
FreeLibrary(hmod); }
这是DLL里的相关代码:
extern "C" __declspec(dllexport) int Calc(int x)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CNJN dlg;
dlg.DoModal();
return 2*x;
}BOOL CMy11App::InitInstance()
{
// TODO: Add your specialized code here and/or call the base class
AfxOleInitModule();
AfxEnableControlContainer();
return CWinApp::InitInstance();
}
怎么回事啊
这是调用的程序:
void CTestDlg::OnButton1()
{
// TODO: Add your control notification handler code here
typedef void (WINAPI * TESTDLL)();
HINSTANCE hmod;
hmod = ::LoadLibrary ("11.dll");
//hmod = ::LoadLibrary ("Yc.HuangXiao.FrameWork.WebControls.dll");
if(hmod==NULL)
{
AfxMessageBox("Fail");
}
TESTDLL lpproc;
lpproc = (TESTDLL)GetProcAddress (hmod,"Show");
if(lpproc!=(TESTDLL)NULL)
(*lpproc)();
FreeLibrary(hmod); }
这是DLL里的相关代码:
extern "C" __declspec(dllexport) int Calc(int x)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CNJN dlg;
dlg.DoModal();
return 2*x;
}BOOL CMy11App::InitInstance()
{
// TODO: Add your specialized code here and/or call the base class
AfxOleInitModule();
AfxEnableControlContainer();
return CWinApp::InitInstance();
}
怎么回事啊
CNjndllApp theApp;extern "C" __declspec(dllexport) void Show()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CoInitialize(NULL);
AfxEnableControlContainer();
//SetSkin(_T("D:\\VC客户端\\pingtest\\AquaOS.ssk"));
CNJN test;
test.DoModal ();
}
我把AFX_MANAGE_STATE(AfxGetStaticModuleState());的位置加错了,应该是在我的DLL程序里,而不是在调用程序里加