佚名通过本文主要向大家介绍了ATLDLL用ClassWizard导入成c++类,使用时出错:InvokewithNULLm_lpDispatch!等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: ATL DLL用ClassWizard导入成c++类,使用时出错:Invoke with NULL m_lpDispatch!
描述:
描述:
怎么解决?(用vb调用的时候没问题。)
class ILeonFine : public COleDispatchDriver
{
public:
ILeonFine() {} // COleDispatchDriver
ILeonFine(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
ILeonFine(const ILeonFine& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
public:
short GetLegs();
void SetLegs(short nNewValue);
void getIntEx();
};
调用代码:
ILeonFine* obj;
int temp = 0;
temp = obj.GetLegs();
TRACE("legs=%d\n",temp);
obj.SetLegs(8);
temp = obj.GetLegs();
TRACE("legs=%d\n",temp);
出错提示:
Warning: attempt to call Invoke with NULL m_lpDispatch!