1 |
#pragma once
|
2 |
|
3 |
template <class T>
|
4 |
class CProxy_DTivoFileEvents : public IConnectionPointImpl<T, &__uuidof( DTivoFileEvents ), CComDynamicUnkArray>
|
5 |
{
|
6 |
//Warning this class will be regenerated by the wizard.
|
7 |
public:
|
8 |
HRESULT Fire_OnProgressChange(DWORD dwFrames, double dblPercentDone = -1.0)
|
9 |
{
|
10 |
HRESULT hr = S_OK;
|
11 |
T * pThis = static_cast<T *>(this);
|
12 |
int cConnections = m_vec.GetSize();
|
13 |
|
14 |
for (int iConnection = 0; iConnection < cConnections; iConnection++)
|
15 |
{
|
16 |
pThis->Lock();
|
17 |
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
|
18 |
pThis->Unlock();
|
19 |
|
20 |
IDispatch * pConnection = static_cast<IDispatch *>(punkConnection.p);
|
21 |
|
22 |
if (pConnection)
|
23 |
{
|
24 |
CComVariant avarParams[2];
|
25 |
avarParams[1] = dwFrames;
|
26 |
avarParams[1].vt = VT_UI4;
|
27 |
avarParams[0] = dblPercentDone;
|
28 |
avarParams[0].vt = VT_R8;
|
29 |
|
30 |
CComVariant varResult;
|
31 |
|
32 |
DISPPARAMS params = { avarParams, NULL, 2, 0 };
|
33 |
pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL);
|
34 |
if (SUCCEEDED(varResult.ChangeType(VT_BOOL)))
|
35 |
{
|
36 |
if (varResult.boolVal == VARIANT_TRUE)
|
37 |
{
|
38 |
hr = S_FALSE;
|
39 |
}
|
40 |
}
|
41 |
}
|
42 |
}
|
43 |
return hr;
|
44 |
}
|
45 |
};
|