WindowsXP/Source/XPSP1/NT/admin/activec/nodemgr/tasksymbol.h
2024-08-03 16:30:48 +02:00

160 lines
5.5 KiB
C++

//+-------------------------------------------------------------------------
//
// Microsoft Windows
//
// Copyright (C) Microsoft Corporation, 2000
//
// File: tasksymbol.h
//
// History: 17-Jan-2000 Vivekj added
//--------------------------------------------------------------------------
#ifndef __TASKSYMBOL_H_
#define __TASKSYMBOL_H_
#include "resource.h" // main symbols
#include <atlctl.h>
/*+-------------------------------------------------------------------------*
* class CProxyTaskSymbolEvents
*
*
* PURPOSE: Event source implementation generated by ATL.
*
*+-------------------------------------------------------------------------*/
template <class T>
class CProxyTaskSymbolEvents : public IConnectionPointImpl<T, &DIID_TaskSymbolEvents, CComDynamicUnkArray>
{
//Warning this class may be recreated by the wizard.
public:
HRESULT Fire_Click()
{
CComVariant varResult;
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)
{
VariantClear(&varResult);
DISPPARAMS disp = { NULL, NULL, 0, 0 };
pDispatch->Invoke(DISPID_CLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
}
}
return varResult.scode;
}
};
/*+-------------------------------------------------------------------------*
* class CTaskSymbol
*
*
* PURPOSE:
*
*+-------------------------------------------------------------------------*/
class ATL_NO_VTABLE CTaskSymbol :
public CComObjectRootEx<CComSingleThreadModel>,
public CComControl<CTaskSymbol>,
public IPersistStreamInitImpl<CTaskSymbol>,
public IOleControlImpl<CTaskSymbol>,
public IOleObjectImpl<CTaskSymbol>,
public IOleInPlaceActiveObjectImpl<CTaskSymbol>,
public IViewObjectExImpl<CTaskSymbol>,
public IOleInPlaceObjectWindowlessImpl<CTaskSymbol>,
public CComCoClass<CTaskSymbol, &CLSID_TaskSymbol>,
public CProxyTaskSymbolEvents< CTaskSymbol >,
public IConnectionPointContainerImpl<CTaskSymbol>,
public IProvideClassInfo2Impl<&CLSID_TaskSymbol, &DIID_TaskSymbolEvents, &LIBID_NODEMGRLib>,
public IPersistPropertyBagImpl<CTaskSymbol>,
public IObjectSafetyImpl<CTaskSymbol, INTERFACESAFE_FOR_UNTRUSTED_CALLER |
INTERFACESAFE_FOR_UNTRUSTED_DATA>
{
typedef IObjectSafetyImpl<CTaskSymbol, INTERFACESAFE_FOR_UNTRUSTED_CALLER |INTERFACESAFE_FOR_UNTRUSTED_DATA> BCSafety;
public:
CTaskSymbol();
DECLARE_MMC_CONTROL_REGISTRATION (
g_szMmcndmgrDll, // implementing DLL
CLSID_TaskSymbol, // CLSID
_T("TaskSymbol Class"), // class name
_T("Control.TaskSymbol.1"), // ProgID
_T("Control.TaskSymbol"), // version-independent ProgID
LIBID_NODEMGRLib, // LIBID
_T("101"), // toolbox bitmap ID
_T("1.0")) // version
DECLARE_PROTECT_FINAL_CONSTRUCT()
BEGIN_COM_MAP(CTaskSymbol)
COM_INTERFACE_ENTRY(IObjectSafety)
COM_INTERFACE_ENTRY(IViewObjectEx)
COM_INTERFACE_ENTRY(IViewObject2)
COM_INTERFACE_ENTRY(IViewObject)
COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceObject)
COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
COM_INTERFACE_ENTRY(IOleControl)
COM_INTERFACE_ENTRY(IOleObject)
COM_INTERFACE_ENTRY(IPersistPropertyBag)
COM_INTERFACE_ENTRY(IPersistStreamInit)
COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
// Connection point container support
COM_INTERFACE_ENTRY(IConnectionPointContainer)
COM_INTERFACE_ENTRY(IProvideClassInfo2)
COM_INTERFACE_ENTRY(IProvideClassInfo)
END_COM_MAP()
BEGIN_CONNECTION_POINT_MAP(CTaskSymbol)
CONNECTION_POINT_ENTRY(DIID_TaskSymbolEvents)
END_CONNECTION_POINT_MAP()
BEGIN_PROP_MAP(CTaskSymbol)
PROP_DATA_ENTRY("Small", m_bSmall, VT_UI4)
PROP_DATA_ENTRY("ConsoleTaskID", m_dwConsoleTaskID, VT_UI4)
// Example entries
// PROP_ENTRY("Property Description", dispid, clsid)
// PROP_PAGE(CLSID_StockColorPage)
END_PROP_MAP()
BEGIN_MSG_MAP(CTaskSymbol)
MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
CHAIN_MSG_MAP(CComControl<CTaskSymbol>)
DEFAULT_REFLECTION_HANDLER()
END_MSG_MAP()
// Handler prototypes:
// LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
// LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
// LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
// IViewObjectEx
DECLARE_VIEW_STATUS(0)
public:
HRESULT OnDraw(ATL_DRAWINFO& di);
LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
private:
typedef std::wstring CString;
UINT m_dwConsoleTaskID;
UINT m_bSmall;
// Need to override the default IObjectSafetyImpl methods per KB article Q168371
public:
STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask,DWORD dwEnabledOptions) {return S_OK;}
};
#endif //__TASKSYMBOL_H_