windows-nt/Source/XPSP1/NT/admin/pchealth/upload/client/eventwrapper/eventwrappercp.h
2020-09-26 16:20:57 +08:00

65 lines
1.9 KiB
C++

#ifndef _EVENTWRAPPERCP_H_
#define _EVENTWRAPPERCP_H_
template <class T>
class CProxy_IUploadEventsWrapperEvents : public IConnectionPointImpl<T, &DIID__IUploadEventsWrapperEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
HRESULT Fire_onStatusChange(IMPCUploadJob * mpcujJob, tagUL_STATUS Status)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[2];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[1] = mpcujJob;
pvars[0] = Status;
DISPPARAMS disp = { pvars, NULL, 2, 0 };
pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
HRESULT Fire_onProgressChange(IMPCUploadJob * mpcujJob, LONG lCurrentSize, LONG lTotalSize)
{
CComVariant varResult;
T* pT = static_cast<T*>(this);
int nConnectionIndex;
CComVariant* pvars = new CComVariant[3];
int nConnections = m_vec.GetSize();
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
{
pT->Lock();
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
pT->Unlock();
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
if (pDispatch != NULL)
{
VariantClear(&varResult);
pvars[2] = mpcujJob;
pvars[1] = lCurrentSize;
pvars[0] = lTotalSize;
DISPPARAMS disp = { pvars, NULL, 3, 0 };
pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
delete[] pvars;
return varResult.scode;
}
};
#endif