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.

76 lines
3.5 KiB

  1. /*************************************************************************/
  2. /* Copyright (C) 1999 Microsoft Corporation */
  3. /* File: CHObj.h */
  4. /* Description: Contains object that is the contained ActiveX controls */
  5. /*************************************************************************/
  6. #ifndef __CHOBJ_H
  7. #define __CHOBJ_H
  8. #include "ccobj.h"
  9. /*************************************************************************/
  10. /* Class: CHostedObject */
  11. /* Description: Object that contains the contained control. */
  12. /*************************************************************************/
  13. class CHostedObject{
  14. public:
  15. CHostedObject(){Init();};
  16. CHostedObject(BSTR strID, BSTR strPropBag, IUnknown* pUnknown);
  17. virtual ~CHostedObject(){Cleanup();};
  18. static HRESULT CreateObject(BSTR strObjectID, BSTR strProgID, BSTR strPropBag, CHostedObject** ppObj);
  19. static HRESULT CHostedObject::AddObject(BSTR strObjectID, BSTR strPropBag, LPUNKNOWN pUnknown, CHostedObject** ppObj);
  20. BSTR GetID(); // Gets the ID of the ActiveX Object
  21. BSTR GetPropBag(); // Gets the string to the property bag
  22. IUnknown* GetUnknown(); // gets the IUnknown of the ActiveX object
  23. HRESULT GetViewObject(IViewObjectEx** pIViewObject);
  24. HRESULT GetOleObject(IOleObject** pIOleObject);
  25. HRESULT InitViewObject(); // initializes the internal view object
  26. HRESULT GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo);
  27. HRESULT GetPos(RECT *rc);
  28. HRESULT SetRawPos(const RECT *rc);
  29. HRESULT SetObjectRects(RECT *rc = NULL);
  30. bool IsWindowless(){return(m_bWindowless);};
  31. void SetWindowless(bool bWindowless){m_bWindowless = bWindowless;};
  32. bool IsActive(){return(m_fActive);};
  33. HRESULT SetActive(bool fActive);
  34. bool IsInputEnabled();
  35. HRESULT SetInputEnabled(bool fEnabled);
  36. bool HasCapture(){return(m_fCapture);};
  37. void SetCapture(bool fCapture){m_fCapture = fCapture;};
  38. bool HasFocus(){return(m_fFocus);};
  39. void SetFocus(bool fFocus){m_fFocus = fFocus;};
  40. HRESULT GetContainerObject(CContainerObject** ppCnt){*ppCnt = m_pContainerObject; if(*ppCnt) return(S_OK); else return(E_UNEXPECTED);}
  41. HRESULT SetContainerObject(CContainerObject* pCnt){m_pContainerObject = pCnt; return(S_OK);};
  42. HRESULT GetWindow(HWND* pHwnd);
  43. HRESULT SetCookie(VARIANT v){m_vCookie = v; return(S_OK);};
  44. HRESULT GetCookie(VARIANT* pv){*pv = m_vCookie; return(S_OK);};
  45. // TODO: DISABLE COPY CONSTRUCTOR !!!
  46. protected:
  47. void Init();
  48. void Cleanup();
  49. private:
  50. CComBSTR m_strID; // ID of the hosted control object (assigned by user)
  51. CComBSTR m_strPropBag; // Property bag info
  52. CComPtr<IUnknown> m_pUnknown; // pointer to IUnknown of the contained object
  53. CComPtr<IViewObjectEx> m_spViewObject; // pointer to IViewObject
  54. CComPtr<IOleObject> m_pOleObject; // pointer to this IOleObject
  55. CContainerObject* m_pContainerObject;
  56. RECT m_rcRawPos; // position without the adjustment for offset
  57. bool m_bWindowless;
  58. bool m_fActive;
  59. bool m_fCapture;
  60. bool m_fFocus;
  61. bool m_fInputEnabled;
  62. CComVariant m_vCookie;
  63. };/* end of class CHostedObject */
  64. #endif __CHOBJ_H
  65. /*************************************************************************/
  66. /* End of file: CHObj.h */
  67. /*************************************************************************/