
//////////////////////////////////////////////////////////////////////////////
// CProxy_CircEvents
template <class T>
class CProxy_CircEvents : public IConnectionPointImpl<T, &DIID__CircEvents, CComDynamicUnkArray >
{
public:
//methods:
//_CircEvents : IDispatch
public:
	void Click()
	{
		T* pT = (T*)this;
		pT->Lock();
		IUnknown** pp = m_vec.begin();
		while (pp < m_vec.end())
		{
			if (*pp != NULL)
			{
				DISPPARAMS disp = { NULL, NULL, 0, 0 };
				IDispatch* pDispatch = reinterpret_cast<IDispatch*>(*pp);
				pDispatch->Invoke(0x1, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
			}
			pp++;
		}
		pT->Unlock();
	}
	void KeyPress(short KeyAscii)
	{
		T* pT = (T*)this;
		pT->Lock();
		IUnknown** pp = m_vec.begin();
		while (pp < m_vec.end())
		{
			if (*pp != NULL)
			{
				VARIANTARG* pvars = new VARIANTARG[1];
				VariantInit(&(pvars[0]));
				pvars[0].vt = VT_I2;
				pvars[0].iVal= KeyAscii;
				DISPPARAMS disp = { pvars, NULL, 1, 0 };
				IDispatch* pDispatch = reinterpret_cast<IDispatch*>(*pp);
				pDispatch->Invoke(0x2, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
				delete[] pvars;
			}
			pp++;
		}
		pT->Unlock();
	}

};

