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.

145 lines
4.1 KiB

  1. // TestSettingsCtrl.h : Declaration of the CTestSettingsCtrl
  2. #pragma once
  3. #include "resource.h" // main symbols
  4. #include <atlctl.h>
  5. #include "AddIn.h"
  6. // CTestSettingsCtrl
  7. class ATL_NO_VTABLE CAppVerifierOptions :
  8. public CComObjectRootEx<CComSingleThreadModel>,
  9. public IDispatchImpl<IAVOptions, &IID_IAVOptions, &LIBID_AppVerifierLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
  10. public IPersistStreamInitImpl<CAppVerifierOptions>,
  11. public IOleControlImpl<CAppVerifierOptions>,
  12. public IOleObjectImpl<CAppVerifierOptions>,
  13. public IOleInPlaceActiveObjectImpl<CAppVerifierOptions>,
  14. public IViewObjectExImpl<CAppVerifierOptions>,
  15. public IOleInPlaceObjectWindowlessImpl<CAppVerifierOptions>,
  16. public CComCoClass<CAppVerifierOptions, &CLSID_AVOptions>,
  17. public CComCompositeControl<CAppVerifierOptions>
  18. {
  19. private:
  20. void CreatePropertySheet(HWND hWndParent);
  21. LRESULT OnSetFocus(
  22. UINT uMsg,
  23. WPARAM wParam,
  24. LPARAM lParam,
  25. BOOL& bHandled
  26. );
  27. LRESULT OnClose(
  28. UINT uMsg,
  29. WPARAM wParam,
  30. LPARAM lParam,
  31. BOOL& bHandled
  32. );
  33. LRESULT OnInitDialog(
  34. UINT uMsg,
  35. WPARAM wParam,
  36. LPARAM lParam,
  37. BOOL& bHandled
  38. );
  39. static BOOL CALLBACK DlgViewOptions(
  40. HWND hDlg,
  41. UINT message,
  42. WPARAM wParam,
  43. LPARAM lParam
  44. );
  45. HWND m_hWndParent;
  46. HWND m_hWndOptionsDlg;
  47. BOOL m_bPropSheetCreated;
  48. HPROPSHEETPAGE* m_phPages;
  49. PROPSHEETPAGE m_PageGlobal;
  50. PROPSHEETHEADER m_psh;
  51. public:
  52. CAppVerifierOptions()
  53. {
  54. m_bCreated = false;
  55. m_bWindowOnly = TRUE;
  56. CalcExtent(m_sizeExtent);
  57. }
  58. virtual HWND CreateControlWindow(HWND hWndParent, RECT& rcPos);
  59. DECLARE_REGISTRY_RESOURCEID(IDR_AV_OPTIONS)
  60. BEGIN_COM_MAP(CAppVerifierOptions)
  61. COM_INTERFACE_ENTRY(IAVOptions)
  62. COM_INTERFACE_ENTRY(IDispatch)
  63. COM_INTERFACE_ENTRY(IViewObjectEx)
  64. COM_INTERFACE_ENTRY(IViewObject2)
  65. COM_INTERFACE_ENTRY(IViewObject)
  66. COM_INTERFACE_ENTRY(IOleInPlaceObjectWindowless)
  67. COM_INTERFACE_ENTRY(IOleInPlaceObject)
  68. COM_INTERFACE_ENTRY2(IOleWindow, IOleInPlaceObjectWindowless)
  69. COM_INTERFACE_ENTRY(IOleInPlaceActiveObject)
  70. COM_INTERFACE_ENTRY(IOleControl)
  71. COM_INTERFACE_ENTRY(IOleObject)
  72. COM_INTERFACE_ENTRY(IPersistStreamInit)
  73. COM_INTERFACE_ENTRY2(IPersist, IPersistStreamInit)
  74. END_COM_MAP()
  75. BEGIN_PROP_MAP(CAppVerifierOptions)
  76. PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4)
  77. PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4)
  78. // Example entries
  79. // PROP_ENTRY("Property Description", dispid, clsid)
  80. // PROP_PAGE(CLSID_StockColorPage)
  81. END_PROP_MAP()
  82. BEGIN_MSG_MAP(CAppVerifierOptions)
  83. COMMAND_HANDLER(IDC_CLEAR_LOG_ON_CHANGES, BN_CLICKED, OnItemChecked)
  84. COMMAND_HANDLER(IDC_BREAK_ON_LOG, BN_CLICKED, OnItemChecked)
  85. COMMAND_HANDLER(IDC_FULL_PAGEHEAP, BN_CLICKED, OnItemChecked)
  86. MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus)
  87. MESSAGE_HANDLER(WM_INITDIALOG, OnInitDialog)
  88. MESSAGE_HANDLER(WM_DESTROY, OnClose)
  89. CHAIN_MSG_MAP(CComCompositeControl<CAppVerifierOptions>)
  90. END_MSG_MAP()
  91. // Handler prototypes:
  92. // LRESULT MessageHandler(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  93. LRESULT OnItemChecked(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled);
  94. LRESULT OnSize(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
  95. BEGIN_SINK_MAP(CAppVerifierOptions)
  96. //Make sure the Event Handlers have __stdcall calling convention
  97. END_SINK_MAP()
  98. STDMETHOD(OnAmbientPropertyChange)(DISPID dispid)
  99. {
  100. if (dispid == DISPID_AMBIENT_BACKCOLOR)
  101. {
  102. SetBackgroundColorFromAmbient();
  103. FireViewChange();
  104. }
  105. return IOleControlImpl<CAppVerifierOptions>::OnAmbientPropertyChange(dispid);
  106. }
  107. // IViewObjectEx
  108. DECLARE_VIEW_STATUS(VIEWSTATUS_SOLIDBKGND | VIEWSTATUS_OPAQUE)
  109. // ITestSettingsCtrl
  110. enum { IDD = IDD_AV_OPTIONS };
  111. DECLARE_PROTECT_FINAL_CONSTRUCT()
  112. HRESULT FinalConstruct()
  113. {
  114. return S_OK;
  115. }
  116. void FinalRelease()
  117. {
  118. }
  119. bool m_bCreated;
  120. };