www.pudn.com > smpplib_src.zip > _IEsmeTransceiverComEvents_CP.h


#pragma once 
 
template 
class CProxy_IEsmeTransceiverComEvents : 
	public IConnectionPointImpl 
{ 
public: 
	HRESULT Fire_OnDeliverSM( IDeliverSMCom *  dsm) 
	{ 
		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] = dsm; 
				DISPPARAMS params = { avarParams, NULL, 1, 0 }; 
				hr = pConnection->Invoke(1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, ¶ms, NULL, NULL, NULL); 
			} 
		} 
		return hr; 
	} 
};