请教DLL中调用COM
qijg 2005-06-29 10:30:39 在exe中创建并声明COM接口,在DLL中如何调用COM?
exe.cpp
---------------------------------
CComPtr<Interface> myCom;
int (__stdcall *FuncInDll)(TInterface *);
SMHwnd = LoadLibrary("aa.dll");
FuncInDll = GetProcAddress(SMHwnd,"test");
FuncInDll(&myCom);
aa.dll
--------------------------------------
extern "C" __declspec(dllexport) void __stdcall test(Interface *myCom);
void __stdcall test(Interface *myCom)
{
MainForm = new TMainForm(Application);
MainForm->ShowModal(myCom);
delete MainForm;
MainForm = NULL;
}
上面的代码问题出在哪?