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.

70 lines
3.3 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. class CContainerObject; // forward definition, so we do not have to include
  9. // extra headers
  10. /*************************************************************************/
  11. /* Class: CHostedObject */
  12. /* Description: Object that contains the contained control. */
  13. /*************************************************************************/
  14. class CHostedObject{
  15. public:
  16. CHostedObject(){Init();};
  17. CHostedObject(BSTR strID, BSTR strPropBag, IUnknown* pUnknown);
  18. virtual ~CHostedObject(){Cleanup();};
  19. static HRESULT CreateObject(BSTR strObjectID, BSTR strProgID, BSTR strPropBag, CHostedObject** ppObj);
  20. static HRESULT CHostedObject::AddObject(BSTR strObjectID, BSTR strPropBag, LPUNKNOWN pUnknown, CHostedObject** ppObj);
  21. BSTR GetID(); // Gets the ID of the ActiveX Object
  22. BSTR GetPropBag(); // Gets the string to the property bag
  23. IUnknown* GetUnknown(); // gets the IUnknown of the ActiveX object
  24. HRESULT GetViewObject(IViewObjectEx** pIViewObject);
  25. HRESULT GetOleObject(IOleObject** pIOleObject);
  26. HRESULT InitViewObject(); // initializes the internal view object
  27. HRESULT GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo);
  28. HRESULT GetPos(RECT *rc);
  29. HRESULT SetRawPos(const RECT *rc);
  30. HRESULT SetObjectRects(RECT *rc = NULL);
  31. bool IsWindowless(){return(m_bWindowless);};
  32. void SetWindowless(bool bWindowless){m_bWindowless = bWindowless;};
  33. bool IsActive(){return(m_fActive);};
  34. HRESULT SetActive(bool fActive);
  35. bool HasCapture(){return(m_fCapture);};
  36. void SetCapture(bool fCapture){m_fCapture = fCapture;};
  37. bool HasFocus(){return(m_fFocus);};
  38. void SetFocus(bool fFocus){m_fFocus = fFocus;};
  39. HRESULT GetContainerObject(CContainerObject** ppCnt){*ppCnt = m_pContainerObject; if(*ppCnt) return(S_OK); else return(E_UNEXPECTED);}
  40. HRESULT SetContainerObject(CContainerObject* pCnt){m_pContainerObject = pCnt; return(S_OK);};
  41. HRESULT GetWindow(HWND* pHwnd);
  42. // TODO: DISABLE COPY CONSTRUCTOR !!!
  43. protected:
  44. void Init();
  45. void Cleanup();
  46. private:
  47. BSTR m_strID; // ID of the hosted control object (assigned by user)
  48. BSTR m_strPropBag; // Property bag info
  49. CComPtr<IUnknown> m_pUnknown; // pointer to IUnknown of the contained object
  50. CComPtr<IViewObjectEx> m_spViewObject; // pointer to IViewObject
  51. CComPtr<IOleObject> m_pOleObject; // pointer to this IOleObject
  52. CContainerObject* m_pContainerObject;
  53. RECT m_rcRawPos; // position without the adjustment for offset
  54. bool m_bWindowless;
  55. bool m_fActive;
  56. bool m_fCapture;
  57. bool m_fFocus;
  58. };/* end of class CHostedObject */
  59. #endif __CHOBJ_H
  60. /*************************************************************************/
  61. /* End of file: CHObj.h */
  62. /*************************************************************************/