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.

103 lines
2.4 KiB

  1. /*
  2. */
  3. #pragma once
  4. #include "mshtml.h"
  5. #include "ihost.h"
  6. #include "SxApwComPtr.h"
  7. #include "atlwin.h"
  8. #include <vector>
  9. #include "FusionTrace.h"
  10. #include "iuiview.h"
  11. #include "SxApwWin.h"
  12. #include "mshtmdid.h"
  13. #include "comdef.h"
  14. #include "exdisp.h"
  15. extern _ATL_FUNC_INFO s_OnClickSignature;
  16. class __declspec(uuid(CLSID_CSxApwHost_declspec_uuid))
  17. CSxApwHost
  18. :
  19. public ATL::CComObjectRootEx<CComSingleThreadModel>,
  20. public ATL::CComCoClass<CSxApwHost, &__uuidof(CSxApwHost)>,
  21. public ISxApwHost,
  22. //public IDispatch,
  23. //public CSxApwHtmlEventSink
  24. public ATL::IDispEventSimpleImpl<1, CSxApwHost, &DIID_HTMLElementEvents2>,
  25. public ATL::IDispEventSimpleImpl<2, CSxApwHost, &DIID_HTMLElementEvents2>
  26. {
  27. typedef ATL::IDispEventSimpleImpl<1, CSxApwHost, &DIID_HTMLElementEvents2> EventDisp1;
  28. typedef ATL::IDispEventSimpleImpl<2, CSxApwHost, &DIID_HTMLElementEvents2> EventDisp2;
  29. public:
  30. CSxApwHost() { }
  31. BEGIN_COM_MAP(CSxApwHost)
  32. COM_INTERFACE_ENTRY(ISxApwHost)
  33. //COM_INTERFACE_ENTRY(IDispatch)
  34. END_COM_MAP()
  35. DECLARE_NO_REGISTRY();
  36. void __stdcall OnClick1()
  37. {
  38. printf("%s\n", __FUNCTION__);
  39. }
  40. void __stdcall OnClick2()
  41. {
  42. printf("%s\n", __FUNCTION__);
  43. }
  44. BEGIN_SINK_MAP(CSxApwHost)
  45. //SINK_ENTRY(1, DISPID_HTMLELEMENTEVENTS2_ONCLICK, OnClick1)
  46. //SINK_ENTRY(2, DISPID_HTMLELEMENTEVENTS2_ONCLICK, OnClick2)
  47. SINK_ENTRY_INFO(1, DIID_HTMLElementEvents2, DISPID_HTMLELEMENTEVENTS2_ONCLICK, OnClick1, &s_OnClickSignature)
  48. SINK_ENTRY_INFO(2, DIID_HTMLElementEvents2, DISPID_HTMLELEMENTEVENTS2_ONCLICK, OnClick2, &s_OnClickSignature)
  49. END_SINK_MAP()
  50. virtual void OnClick()
  51. {
  52. }
  53. STDMETHOD(SetDataSource)(
  54. LPCWSTR
  55. );
  56. STDMETHOD(CreateView)(
  57. LPCWSTR
  58. );
  59. STDMETHOD(DestroyView)(
  60. LPCWSTR
  61. ) { return S_OK; }
  62. STDMETHOD(RunQuery)(
  63. LPCWSTR
  64. );
  65. STDMETHOD(OnNextRow)(
  66. int nColumns,
  67. const LPCWSTR columns[]
  68. );
  69. STDMETHOD(OnRowCountEstimateAvailable)(
  70. int
  71. );
  72. STDMETHOD(OnQueryDone)(
  73. ) { return S_OK; }
  74. STDMETHOD(InformSchema)(
  75. const SxApwColumnInfo rgColumnInfo[],
  76. int nColumnCount
  77. );
  78. HRESULT Main();
  79. private:
  80. typedef std::vector<CSxApwComPtr<ISxApwUiView> > Views_t;
  81. Views_t m_views;
  82. CSxApwComPtr<ISxApwDataSource> m_dataSource;
  83. };