-
-
[旧帖] [求助]菜鸟,在线等。 0.00雪花
-
发表于: 2015-9-2 16:36 1149
-
直接贴代码:
HRESULT Fire_OnGetPin(BSTR bstrParam)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
CComPtr<IUnknown> sp;
sp.Attach(GetInterfaceAt(nConnectionIndex));
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = bstrParam;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
经过调试代码异常在int nConnections = m_vec.GetSize();位置, quickwatch后发现m_vec没有值,在线等COM技术大牛解释个前因后果。
HRESULT Fire_OnGetPin(BSTR bstrParam)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[1];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
CComPtr<IUnknown> sp;
sp.Attach(GetInterfaceAt(nConnectionIndex));
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[0] = bstrParam;
DISPPARAMS disp = { pvars, NULL, 1, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
经过调试代码异常在int nConnections = m_vec.GetSize();位置, quickwatch后发现m_vec没有值,在线等COM技术大牛解释个前因后果。
[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)
赞赏
看原图
赞赏
雪币:
留言: