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.

107 lines
4.6 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. class Container : public IOleClientSite,
  16. public IOleInPlaceSite,
  17. public IOleInPlaceFrame,
  18. public IOleControlSite,
  19. public IDispatch
  20. {
  21. private:
  22. ULONG m_cRefs; // ref count
  23. HWND m_hwnd; // window handle of the container
  24. HWND m_hwndStatus; // status window handle
  25. IUnknown *m_punk; // IUnknown of contained object
  26. RECT m_rect; // size of control
  27. public:
  28. Container();
  29. ~Container();
  30. public:
  31. // *** IUnknown Methods ***
  32. STDMETHOD(QueryInterface)(REFIID riid, PVOID *ppvObject);
  33. STDMETHOD_(ULONG, AddRef)(void);
  34. STDMETHOD_(ULONG, Release)(void);
  35. // *** IOleClientSite Methods ***
  36. STDMETHOD (SaveObject)();
  37. STDMETHOD (GetMoniker)(DWORD dwAssign, DWORD dwWhichMoniker, LPMONIKER *ppMk);
  38. STDMETHOD (GetContainer)(LPOLECONTAINER *ppContainer);
  39. STDMETHOD (ShowObject)();
  40. STDMETHOD (OnShowWindow)(BOOL fShow);
  41. STDMETHOD (RequestNewObjectLayout)();
  42. // *** IOleWindow Methods ***
  43. STDMETHOD (GetWindow) (HWND * phwnd);
  44. STDMETHOD (ContextSensitiveHelp) (BOOL fEnterMode);
  45. // *** IOleInPlaceSite Methods ***
  46. STDMETHOD (CanInPlaceActivate) (void);
  47. STDMETHOD (OnInPlaceActivate) (void);
  48. STDMETHOD (OnUIActivate) (void);
  49. STDMETHOD (GetWindowContext) (IOleInPlaceFrame ** ppFrame, IOleInPlaceUIWindow ** ppDoc, LPRECT lprcPosRect, LPRECT lprcClipRect, LPOLEINPLACEFRAMEINFO lpFrameInfo);
  50. STDMETHOD (Scroll) (SIZE scrollExtent);
  51. STDMETHOD (OnUIDeactivate) (BOOL fUndoable);
  52. STDMETHOD (OnInPlaceDeactivate) (void);
  53. STDMETHOD (DiscardUndoState) (void);
  54. STDMETHOD (DeactivateAndUndo) (void);
  55. STDMETHOD (OnPosRectChange) (LPCRECT lprcPosRect);
  56. // *** IOleInPlaceUIWindow Methods ***
  57. STDMETHOD (GetBorder)(LPRECT lprectBorder);
  58. STDMETHOD (RequestBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  59. STDMETHOD (SetBorderSpace)(LPCBORDERWIDTHS lpborderwidths);
  60. STDMETHOD (SetActiveObject)(IOleInPlaceActiveObject * pActiveObject,
  61. LPCOLESTR lpszObjName);
  62. // *** IOleInPlaceFrame Methods ***
  63. STDMETHOD (InsertMenus)(HMENU hmenuShared, LPOLEMENUGROUPWIDTHS lpMenuWidths);
  64. STDMETHOD (SetMenu)(HMENU hmenuShared, HOLEMENU holemenu, HWND hwndActiveObject);
  65. STDMETHOD (RemoveMenus)(HMENU hmenuShared);
  66. STDMETHOD (SetStatusText)(LPCOLESTR pszStatusText);
  67. STDMETHOD (EnableModeless)(BOOL fEnable);
  68. STDMETHOD (TranslateAccelerator)(LPMSG lpmsg, WORD wID);
  69. // *** IOleControlSite Methods ***
  70. STDMETHOD (OnControlInfoChanged)(void);
  71. STDMETHOD (LockInPlaceActive)(BOOL fLock);
  72. STDMETHOD (GetExtendedControl)(IDispatch **ppDisp);
  73. STDMETHOD (TransformCoords)(POINTL *pptlHimetric, POINTF *pptfContainer, DWORD dwFlags);
  74. STDMETHOD (TranslateAccelerator)(LPMSG pMsg, DWORD grfModifiers);
  75. STDMETHOD (OnFocus)(BOOL fGotFocus);
  76. STDMETHOD (ShowPropertyFrame)(void);
  77. // *** IDispatch Methods ***
  78. STDMETHOD (GetIDsOfNames)(REFIID riid, OLECHAR FAR* FAR* rgszNames, unsigned int cNames, LCID lcid, DISPID FAR* rgdispid);
  79. STDMETHOD (GetTypeInfo)(unsigned int itinfo, LCID lcid, ITypeInfo FAR* FAR* pptinfo);
  80. STDMETHOD (GetTypeInfoCount)(unsigned int FAR * pctinfo);
  81. STDMETHOD (Invoke)(DISPID dispid, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS FAR *pdispparams, VARIANT FAR *pvarResult, EXCEPINFO FAR * pexecinfo, unsigned int FAR *puArgErr);
  82. public:
  83. void add(BSTR clsid);
  84. void remove();
  85. void setParent(HWND hwndParent);
  86. void setLocation(int x, int y, int width, int height);
  87. void setVisible(BOOL fVisible);
  88. void setFocus(BOOL fFocus);
  89. void setStatusWindow(HWND hwndStatus);
  90. void translateKey(MSG msg);
  91. IDispatch *getDispatch();
  92. IUnknown * getUnknown();
  93. };
  94. #endif