261 lines
7.7 KiB
C
261 lines
7.7 KiB
C
|
//===========================================================================
|
||
|
//
|
||
|
// msvidcp.h : msvidctl event connection point handler
|
||
|
// Copyright (c) Microsoft Corporation 1999-2000.
|
||
|
//
|
||
|
/////////////////////////////////////////////////////////////////////////////
|
||
|
#ifndef _MSVideoCP_H_
|
||
|
#define _MSVideoCP_H_
|
||
|
|
||
|
//#import "..\..\common\include\MSVidCtl.tlb" raw_interfaces_only, raw_native_types, no_namespace, named_guids //"Import typelib"
|
||
|
template <class T>
|
||
|
class CProxy_IMSVidCtlEvents : public IConnectionPointImpl<T, &DIID__IMSVidCtlEvents, CComDynamicUnkArray>
|
||
|
{
|
||
|
//Warning this class may be recreated by the wizard.
|
||
|
public:
|
||
|
VOID Fire_Click()
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||
|
pDispatch->Invoke(DISPID_CLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
VOID Fire_DblClick()
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
DISPPARAMS disp = { NULL, NULL, 0, 0 };
|
||
|
pDispatch->Invoke(DISPID_DBLCLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|
||
|
VOID Fire_KeyDown(SHORT * KeyCode, SHORT Shift)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[2];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[1] = KeyCode;
|
||
|
pvars[0] = Shift;
|
||
|
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||
|
pDispatch->Invoke(DISPID_KEYDOWN, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_KeyPress(SHORT * KeyAscii)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[1];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[0] = *KeyAscii;
|
||
|
DISPPARAMS disp = { pvars, NULL, 1, 0 };
|
||
|
pDispatch->Invoke(DISPID_KEYPRESS, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_KeyUp(SHORT * KeyCode, SHORT Shift)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[2];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[1] = KeyCode;
|
||
|
pvars[0] = Shift;
|
||
|
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||
|
pDispatch->Invoke(DISPID_KEYUP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_MouseDown(SHORT Button, SHORT Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[4];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[3] = Button;
|
||
|
pvars[2] = Shift;
|
||
|
pvars[1] = x;
|
||
|
pvars[0] = y;
|
||
|
DISPPARAMS disp = { pvars, NULL, 4, 0 };
|
||
|
pDispatch->Invoke(DISPID_MOUSEDOWN, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_MouseMove(SHORT Button, SHORT Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[4];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[3] = Button;
|
||
|
pvars[2] = Shift;
|
||
|
pvars[1] = x;
|
||
|
pvars[0] = y;
|
||
|
DISPPARAMS disp = { pvars, NULL, 4, 0 };
|
||
|
pDispatch->Invoke(DISPID_MOUSEMOVE, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_MouseUp(SHORT Button, SHORT Shift, OLE_XPOS_PIXELS x, OLE_YPOS_PIXELS y)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[4];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[3] = Button;
|
||
|
pvars[2] = Shift;
|
||
|
pvars[1] = x;
|
||
|
pvars[0] = y;
|
||
|
DISPPARAMS disp = { pvars, NULL, 4, 0 };
|
||
|
pDispatch->Invoke(DISPID_MOUSEUP, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_Error(SHORT Number, BSTR * Description, LONG Scode, BSTR Source, BSTR HelpFile, LONG HelpContext, CHAR * CancelDisplay)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[7];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
pvars[6] = Number;
|
||
|
pvars[5] = Description;
|
||
|
pvars[4] = Scode;
|
||
|
pvars[3] = Source;
|
||
|
pvars[2] = HelpFile;
|
||
|
pvars[1] = HelpContext;
|
||
|
pvars[0] = CancelDisplay;
|
||
|
DISPPARAMS disp = { pvars, NULL, 7, 0 };
|
||
|
pDispatch->Invoke(DISPID_ERROREVENT, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
VOID Fire_StateChange(MSVidCtlStateList PrevState, MSVidCtlStateList CurrState)
|
||
|
{
|
||
|
T* pT = static_cast<T*>(this);
|
||
|
int nConnectionIndex;
|
||
|
CComVariant* pvars = new CComVariant[2];
|
||
|
int nConnections = m_vec.GetSize();
|
||
|
TRACELSM(TRACE_DETAIL, (dbgDump << "CVidCtl::FireStateChange(" << PrevState << ", " << CurrState << ")"), "");
|
||
|
for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
|
||
|
{
|
||
|
pT->Lock();
|
||
|
CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
|
||
|
pT->Unlock();
|
||
|
IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
|
||
|
if (pDispatch != NULL)
|
||
|
{
|
||
|
|
||
|
pvars[1] = PrevState;
|
||
|
pvars[0] = CurrState;
|
||
|
DISPPARAMS disp = { pvars, NULL, 2, 0 };
|
||
|
pDispatch->Invoke(dispidStateChange, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, NULL, NULL, NULL);
|
||
|
}
|
||
|
}
|
||
|
delete[] pvars;
|
||
|
|
||
|
}
|
||
|
};
|
||
|
|
||
|
#endif
|