How to raise events with an Interface as argument
Hi,
I have to raise an event from my library and, one of the parameter is
an IDispatch derived interface:
HRESULT Fire_OnStreamStateChanged( IWaveStream* Sender, short
new_state )
{
HRESULT hr = S_OK;
T * pThis = static_cast<T *>(this);
int cConnections = m_vec.GetSize();
for (int iConnection = 0; iConnection < cConnections; iConnection++)
{
pThis->Lock();
CComPtr<IUnknown> punkConnection = m_vec.GetAt(iConnection);
pThis->Unlock();
CComQIPtr< IDispatch, &IID_IDispatch > pDispatch
( punkConnection );
if (pDispatch != NULL)
{
CComVariant avarParams[2];
....?????
....?????
VariantInit(&avarParams[0]);
avarParams[0].vt = ...???;
avarParams[1] = new_state;
DISPPARAMS params = { avarParams, NULL, 2, 0 };
hr = pDispatch->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT,
DISPATCH_METHOD, ¶ms, NULL, NULL, NULL);
}
}
return hr;
}
How I have to pack the WaveStream* Sender object?
Thanks for the suggestions!
Daniele.