Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

159 lines
5.5 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 2000
  6. //
  7. // File: tasksymbol.h
  8. //
  9. // History: 17-Jan-2000 Vivekj added
  10. //--------------------------------------------------------------------------
  11. #ifndef __TASKSYMBOL_H_
  12. #define __TASKSYMBOL_H_
  13. #include "resource.h" // main symbols
  14. #include <atlctl.h>
  15. /*+-------------------------------------------------------------------------*
  16. * class CProxyTaskSymbolEvents
  17. *
  18. *
  19. * PURPOSE: Event source implementation generated by ATL.
  20. *
  21. *+-------------------------------------------------------------------------*/
  22. template <class T>
  23. class CProxyTaskSymbolEvents : public IConnectionPointImpl<T, &DIID_TaskSymbolEvents, CComDynamicUnkArray>
  24. {
  25. //Warning this class may be recreated by the wizard.
  26. public:
  27. HRESULT Fire_Click()
  28. {
  29. CComVariant varResult;
  30. T* pT = static_cast<T*>(this);
  31. int nConnectionIndex;
  32. int nConnections = m_vec.GetSize();
  33. for (nConnectionIndex = 0; nConnectionIndex < nConnections; nConnectionIndex++)
  34. {
  35. pT->Lock();
  36. CComPtr<IUnknown> sp = m_vec.GetAt(nConnectionIndex);
  37. pT->Unlock();
  38. IDispatch* pDispatch = reinterpret_cast<IDispatch*>(sp.p);
  39. if (pDispatch != NULL)
  40. {
  41. VariantClear(&varResult);
  42. DISPPARAMS disp = { NULL, NULL, 0, 0 };
  43. pDispatch->Invoke(DISPID_CLICK, IID_NULL, LOCALE_USER_DEFAULT, DISPATCH_METHOD, &disp, &varResult, NULL, NULL);
  44. }
  45. }
  46. return varResult.scode;
  47. }
  48. };
  49. /*+-------------------------------------------------------------------------*
  50. * class CTaskSymbol
  51. *
  52. *
  53. * PURPOSE:
  54. *
  55. *+-------------------------------------------------------------------------*/
  56. class ATL_NO_VTABLE CTaskSymbol :
  57. public CComObjectRootEx<CComSingleThreadModel>,
  58. public CComControl<CTaskSymbol>,
  59. public IPersistStreamInitImpl<CTaskSymbol>,
  60. public IOleControlImpl<CTaskSymbol>,
  61. public IOleObjectImpl<CTaskSymbol>,
  62. public IOleInPlaceActiveObjectImpl<CTaskSymbol>,
  63. public IViewObjectExImpl<CTaskSymbol>,
  64. public IOleInPlaceObjectWindowlessImpl<CTaskSymbol>,
  65. public CComCoClass<CTaskSymbol, &CLSID_TaskSymbol>,
  66. public CProxyTaskSymbolEvents< CTaskSymbol >,
  67. public IConnectionPointContainerImpl<CTaskSymbol>,
  68. public IProvideClassInfo2Impl<&CLSID_TaskSymbol, &DIID_TaskSymbolEvents, &LIBID_NODEMGRLib>,
  69. public IPersistPropertyBagImpl<CTaskSymbol>,
  70. public IObjectSafetyImpl<CTaskSymbol, INTERFACESAFE_FOR_UNTRUSTED_CALLER |
  71. INTERFACESAFE_FOR_UNTRUSTED_DATA>
  72. {
  73. typedef IObjectSafetyImpl<CTaskSymbol, INTERFACESAFE_FOR_UNTRUSTED_CALLER |INTERFACESAFE_FOR_UNTRUSTED_DATA> BCSafety;
  74. public:
  75. CTaskSymbol();
  76. DECLARE_MMC_CONTROL_REGISTRATION (
  77. g_szMmcndmgrDll, // implementing DLL
  78. CLSID_TaskSymbol, // CLSID
  79. _T("TaskSymbol Class"), // class name
  80. _T("Control.TaskSymbol.1"), // ProgID
  81. _T("Control.TaskSymbol"), // version-independent ProgID
  82. LIBID_NODEMGRLib, // LIBID
  83. _T("101"), // toolbox bitmap ID
  84. _T("1.0")) // version
  85. DECLARE_PROTECT_FINAL_CONSTRUCT()
  86. BEGIN_COM_MAP(CTaskSymbol)
  87. COM_INTERFACE_ENTRY(IObjectSafety)
  88. COM_INTERFACE_ENTRY(IViewObjectEx)
  89. COM_INTERFACE_ENTRY(IViewObject2)
  90. COM_INTERFACE_ENTRY(IViewObject)
  91. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  92. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  93. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  94. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  95. COM_INTERFACE_ENTRY(IOleControl)
  96. COM_INTERFACE_ENTRY(IOleObject)
  97. COM_INTERFACE_ENTRY(IPersistPropertyBag)
  98. COM_INTERFACE_ENTRY(IPersistStreamInit)
  99. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  100. // Connection point container support
  101. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  102. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  103. COM_INTERFACE_ENTRY(IProvideClassInfo)
  104. END_COM_MAP()
  105. BEGIN_CONNECTION_POINT_MAP(CTaskSymbol)
  106. CONNECTION_POINT_ENTRY(DIID_TaskSymbolEvents)
  107. END_CONNECTION_POINT_MAP()
  108. BEGIN_PROP_MAP(CTaskSymbol)
  109. PROP_DATA_ENTRY("Small", m_bSmall, VT_UI4)
  110. PROP_DATA_ENTRY("ConsoleTaskID", m_dwConsoleTaskID, VT_UI4)
  111. // Example entries
  112. // PROP_ENTRY("Property Description", dispid, clsid)
  113. // PROP_PAGE(CLSID_StockColorPage)
  114. END_PROP_MAP()
  115. BEGIN_MSG_MAP(CTaskSymbol)
  116. MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
  117. MESSAGE_HANDLER(WM_SETCURSOR, OnSetCursor)
  118. CHAIN_MSG_MAP(CComControl<CTaskSymbol>)
  119. DEFAULT_REFLECTION_HANDLER()
  120. END_MSG_MAP()
  121. // Handler prototypes:
  122. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  123. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  124. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  125. // IViewObjectEx
  126. DECLARE_VIEW_STATUS(0)
  127. public:
  128. HRESULT OnDraw(ATL_DRAWINFO& di);
  129. LRESULT OnLButtonDown(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  130. LRESULT OnSetCursor(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  131. private:
  132. typedef std::wstring CString;
  133. UINT m_dwConsoleTaskID;
  134. UINT m_bSmall;
  135. // Need to override the default IObjectSafetyImpl methods per KB article Q168371
  136. public:
  137. STDMETHOD(SetInterfaceSafetyOptions)(REFIID riid, DWORD dwOptionSetMask,DWORD dwEnabledOptions) {return S_OK;}
  138. };
  139. #endif //__TASKSYMBOL_H_