//+------------------------------------------------------------------------- // // 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 /*+-------------------------------------------------------------------------* * class CProxyTaskSymbolEvents * * * PURPOSE: Event source implementation generated by ATL. * *+-------------------------------------------------------------------------*/ template class CProxyTaskSymbolEvents : public IConnectionPointImpl { //Warning this class may be recreated by the wizard. public: HRESULT Fire_Click() { CComVariant varResult; T* pT = static_cast(this); int nConnectionIndex; int nConnections = m_vec.GetSize(); for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++) { pT->Lock(); CComPtr sp = m_vec.GetAt(nConnectionIndex); pT->Unlock(); IDispatch* pDispatch = reinterpret_cast(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, public CComControl, public IPersistStreamInitImpl, public IOleControlImpl, public IOleObjectImpl, public IOleInPlaceActiveObjectImpl, public IViewObjectExImpl, public IOleInPlaceObjectWindowlessImpl, public CComCoClass, public CProxyTaskSymbolEvents< CTaskSymbol >, public IConnectionPointContainerImpl, public IProvideClassInfo2Impl<&CLSID_TaskSymbol, &DIID_TaskSymbolEvents, &LIBID_NODEMGRLib>, public IPersistPropertyBagImpl, public IObjectSafetyImpl { typedef IObjectSafetyImpl 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) 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_