/* * Copyright 2013 Red Hat, Inc. and/or its affiliates. * * Licensed under the GNU General Public License, version 2 or any * later version. See the file COPYING in the top-level directory of * this distribution or http://www.gnu.org/licenses/gpl-2.0.txt. */ #pragma once template class CProxy_IOSpiceXEvents : public IConnectionPointImpl { public: HRESULT Fire_OnMenuItemSelected(ULONG ulItemID) { 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 avarParams[1]; avarParams[0] = ulItemID; avarParams[0].vt = VT_I4; CComVariant varResult; DISPPARAMS params = { avarParams, NULL, 1, 0 }; hr = pConnection->Invoke(2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL); } } return hr; } HRESULT Fire_OnDisconnected( LONG ErrCode) { 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 avarParams[1]; avarParams[0] = ErrCode; avarParams[0].vt = VT_I4; CComVariant varResult; DISPPARAMS params = { avarParams, NULL, 1, 0 }; hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, &varResult, NULL, NULL); } } return hr; } };