/////////////////////////////////////////////////////////////////////////// // _IButtonDemoEvents_CP.h : Implementation of CButtonDemo Event Invoker // // ActiveX control provides a labeled button, publishing a click event // // // // Jim Fawcett, Demo for CSE775 - Distributed Objects, Spring 2005 // /////////////////////////////////////////////////////////////////////////// #pragma once template class CProxy_IButtonDemoEvents : public IConnectionPointImpl { public: HRESULT Fire_Clicked() { HRESULT hr = S_OK; T * pThis = static_cast(this); int cConnections = m_vec.GetSize(); for (int iConnection = 0; iConnection < cConnections; iConnection++) { pThis->Lock(); CComPtr punkConnection = m_vec.GetAt(iConnection); pThis->Unlock(); IDispatch * pConnection = static_cast(punkConnection.p); if (pConnection) { CComVariant varResult; DISPPARAMS params = { NULL, NULL, 0, 0 }; hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL); } } return hr; } };