Leaked source code of windows server 2003
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.

115 lines
4.0 KiB

  1. // AppReport.h : Declaration of the CAppReport
  2. #ifndef __APPREPORT_H_
  3. #define __APPREPORT_H_
  4. #include "resource.h" // main symbols
  5. #include <atlctl.h>
  6. #include <atlwin.h>
  7. #include <strsafe.h>
  8. #include <commdlg.h>
  9. #include <shimdb.h>
  10. /////////////////////////////////////////////////////////////////////////////
  11. // CAppReport
  12. class ATL_NO_VTABLE CAppReport :
  13. public CComObjectRootEx<CComSingleThreadModel>,
  14. public IDispatchImpl<IAppReport, &IID_IAppReport, &LIBID_APPCOMPRLib>,
  15. public CComControl<CAppReport>,
  16. public IPersistStreamInitImpl<CAppReport>,
  17. public IOleControlImpl<CAppReport>,
  18. public IOleObjectImpl<CAppReport>,
  19. public IOleInPlaceActiveObjectImpl<CAppReport>,
  20. public IViewObjectExImpl<CAppReport>,
  21. public IOleInPlaceObjectWindowlessImpl<CAppReport>,
  22. public IPersistStorageImpl<CAppReport>,
  23. public ISpecifyPropertyPagesImpl<CAppReport>,
  24. public IQuickActivateImpl<CAppReport>,
  25. public IDataObjectImpl<CAppReport>,
  26. public IProvideClassInfo2Impl<&CLSID_AppReport, NULL, &LIBID_APPCOMPRLib>,
  27. public CComCoClass<CAppReport, &CLSID_AppReport>,
  28. public IObjectSafetyImpl<CAppReport, INTERFACESAFE_FOR_UNTRUSTED_CALLER
  29. |INTERFACESAFE_FOR_UNTRUSTED_DATA>
  30. {
  31. public:
  32. CAppReport()
  33. {
  34. }
  35. DECLARE_REGISTRY_RESOURCEID(IDR_APPREPORT)
  36. DECLARE_PROTECT_FINAL_CONSTRUCT()
  37. BEGIN_COM_MAP(CAppReport)
  38. COM_INTERFACE_ENTRY(IAppReport)
  39. COM_INTERFACE_ENTRY(IDispatch)
  40. COM_INTERFACE_ENTRY(IViewObjectEx)
  41. COM_INTERFACE_ENTRY(IViewObject2)
  42. COM_INTERFACE_ENTRY(IViewObject)
  43. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  44. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  45. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  46. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  47. COM_INTERFACE_ENTRY(IOleControl)
  48. COM_INTERFACE_ENTRY(IOleObject)
  49. COM_INTERFACE_ENTRY(IPersistStreamInit)
  50. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  51. COM_INTERFACE_ENTRY(ISpecifyPropertyPages)
  52. COM_INTERFACE_ENTRY(IQuickActivate)
  53. COM_INTERFACE_ENTRY(IPersistStorage)
  54. COM_INTERFACE_ENTRY(IDataObject)
  55. COM_INTERFACE_ENTRY(IProvideClassInfo)
  56. COM_INTERFACE_ENTRY(IProvideClassInfo2)
  57. COM_INTERFACE_ENTRY(IObjectSafety)
  58. END_COM_MAP()
  59. BEGIN_PROP_MAP(CAppReport)
  60. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  61. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  62. // Example entries
  63. // PROP_ENTRY("Property Description", dispid, clsid)
  64. // PROP_PAGE(CLSID_StockColorPage)
  65. END_PROP_MAP()
  66. BEGIN_MSG_MAP(CAppReport)
  67. CHAIN_MSG_MAP(CComControl<CAppReport>)
  68. DEFAULT_REFLECTION_HANDLER()
  69. END_MSG_MAP()
  70. // Handler prototypes:
  71. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  72. // LRESULT CommandHandler(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  73. // LRESULT NotifyHandler(int idCtrl, LPNMHDR pnmh, BOOL& bHandled);
  74. // IViewObjectEx
  75. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  76. // IAppReport
  77. public:
  78. STDMETHOD(CreateReport)(/*[in]*/ BSTR bstrTitle, /*[in]*/ BSTR bstrProblemType, /*[in]*/ BSTR bstrComment, /*[in]*/ BSTR bstrACWResult, /*[in]*/ BSTR bstrAppName, /*[out, retval]*/ VARIANT* DwResult);
  79. STDMETHOD(GetApplicationFromList)(/*[in]*/ BSTR bstrTitle, /*[out, retval]*/ VARIANT *bstrExeName);
  80. STDMETHOD(BrowseForExecutable)(/*[IN]*/ BSTR bstrWinTitle, /*[IN]*/ BSTR bstrPreviousPath, /*[OUT]*/ VARIANT *bstrExeName);
  81. HRESULT OnDraw(ATL_DRAWINFO& di)
  82. {
  83. RECT& rc = *(RECT*)di.prcBounds;
  84. Rectangle(di.hdcDraw, rc.left, rc.top, rc.right, rc.bottom);
  85. SetTextAlign(di.hdcDraw, TA_CENTER|TA_BASELINE);
  86. LPCTSTR pszText = _T("ATL 3.0 : AppReport");
  87. TextOut(di.hdcDraw,
  88. (rc.left + rc.right) / 2,
  89. (rc.top + rc.bottom) / 2,
  90. pszText,
  91. lstrlen(pszText));
  92. return S_OK;
  93. }
  94. private:
  95. HRESULT GetWindowHandle(LPWSTR wszWinTitle, HWND* phwnd);
  96. };
  97. #endif //__APPREPORT_H_