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.

117 lines
5.1 KiB

  1. //////////////////////////////////////////////////////////////////////////
  2. //
  3. // container.h
  4. //
  5. // This file contains the complete class specification of an ActiveX
  6. // control container. This purpose of this container is to test
  7. // a single control being hosted.
  8. //
  9. // (C) Copyright 1997 by Microsoft Corporation. All rights reserved.
  10. //
  11. //////////////////////////////////////////////////////////////////////////
  12. #ifndef _CONTAINER_H_
  13. #define _CONTAINER_H_
  14. #include <ocidl.h>
  15. #include <docobj.h>
  16. #include <atlbase.h>
  17. class CContainer : public IOleClientSite,
  18. public IOleInPlaceSite,
  19. public IOleInPlaceFrame,
  20. public IOleControlSite,
  21. public IDispatch,
  22. public IOleCommandTarget
  23. {
  24. private:
  25. ULONG m_cRefs; // ref count
  26. HWND m_hwnd; // window handle of the container
  27. HWND m_hwndStatus; // status window handle
  28. IUnknown *m_punk; // IUnknown of contained object
  29. RECT m_rect; // size of control
  30. public:
  31. CContainer();
  32. ~CContainer();
  33. public:
  34. // *** IUnknown Methods ***
  35. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  36. STDMETHOD_(ULONG, AddRef)(void);
  37. STDMETHOD_(ULONG, Release)(void);
  38. // *** IOleClientSite Methods ***
  39. STDMETHOD (SaveObject)();
  40. STDMETHOD (GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMk);
  41. STDMETHOD (GetContainer)(LPOLECONTAINER *ppContainer);
  42. STDMETHOD (ShowObject)();
  43. STDMETHOD (OnShowWindow)(BOOL fShow);
  44. STDMETHOD (RequestNewObjectLayout)();
  45. // *** IOleWindow Methods ***
  46. STDMETHOD (GetWindow) (HWND * phwnd);
  47. STDMETHOD (ContextSensitiveHelp) (BOOL fEnterMode);
  48. // *** IOleInPlaceSite Methods ***
  49. STDMETHOD (CanInPlaceActivate) (void);
  50. STDMETHOD (OnInPlaceActivate) (void);
  51. STDMETHOD (OnUIActivate) (void);
  52. STDMETHOD (GetWindowContext) (IOleInPlaceFrame ** ppFrame, IOleInPlaceUIWindow ** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  53. STDMETHOD (Scroll) (SIZE scrollExtent);
  54. STDMETHOD (OnUIDeactivate) (BOOL fUndoable);
  55. STDMETHOD (OnInPlaceDeactivate) (void);
  56. STDMETHOD (DiscardUndoState) (void);
  57. STDMETHOD (DeactivateAndUndo) (void);
  58. STDMETHOD (OnPosRectChange) (LPCRECT lprcPosRect);
  59. // *** IOleInPlaceUIWindow Methods ***
  60. STDMETHOD (GetBorder)(LPRECT lprectBorder);
  61. STDMETHOD (RequestBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  62. STDMETHOD (SetBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  63. STDMETHOD (SetActiveObject)(IOleInPlaceActiveObject * pActiveObject,
  64. LPCOLESTR lpszObjName);
  65. // *** IOleInPlaceFrame Methods ***
  66. STDMETHOD (InsertMenus)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  67. STDMETHOD (SetMenu)(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  68. STDMETHOD (RemoveMenus)(HMENU hmenuShared);
  69. STDMETHOD (SetStatusText)(LPCOLESTR pszStatusText);
  70. STDMETHOD (EnableModeless)(BOOL fEnable);
  71. STDMETHOD (TranslateAccelerator)(LPMSG lpmsg, WORD wID);
  72. // *** IOleControlSite Methods ***
  73. STDMETHOD (OnControlInfoChanged)(void);
  74. STDMETHOD (LockInPlaceActive)(BOOL fLock);
  75. STDMETHOD (GetExtendedControl)(IDispatch **ppDisp);
  76. STDMETHOD (TransformCoords)(POINTL *pptlHimetric, POINTF *pptfContainer, DWORD dwFlags);
  77. STDMETHOD (TranslateAccelerator)(LPMSG pMsg, DWORD grfModifiers);
  78. STDMETHOD (OnFocus)(BOOL fGotFocus);
  79. STDMETHOD (ShowPropertyFrame)(void);
  80. // *** IDispatch Methods ***
  81. STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  82. STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  83. STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
  84. STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  85. // *** IOleCommandTarget Methods ***
  86. STDMETHOD (QueryStatus)(const GUID *pguidCmdGroup, ULONG cCmds, OLECMD prgCmds[ ], OLECMDTEXT *pCmdText);
  87. STDMETHOD (Exec)(const GUID *pguidCmdGroup, DWORD nCmdID, DWORD nCmdexecopt, VARIANT *pvaIn, VARIANT *pvaOut);
  88. public:
  89. HRESULT add(BSTR clsid);
  90. void remove();
  91. void setParent(HWND hwndParent);
  92. void setLocation(int x, int y, int width, int height);
  93. void setVisible(BOOL fVisible);
  94. void setFocus(BOOL fFocus);
  95. void setStatusWindow(HWND hwndStatus);
  96. HRESULT translateKey(MSG *pmsg);
  97. IDispatch *getDispatch();
  98. IUnknown * getUnknown();
  99. HRESULT InPlaceActivate( void );
  100. };
  101. #endif