IOleClientSite Interface

 

Home COM GDI+ WebBrowser Data Access

IID_IOleClientSite

{00000118-0000-0000-C000-000000000046}

 

 

The IOleClientSite interface is the primary means by which an embedded object obtains information about the location and extent of its display site, its moniker, its user interface, and other resources provided by its container. An object server calls IOleClientSite to request services from the container. A container must provide one instance of IOleClientSite for every compound-document object it contains.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IOleClientSite Methods

Description

SaveObject

Saves embedded object.

GetMoniker

Requests object's moniker.

GetContainer

Requests pointer to object's container.

ShowObject

Asks container to display object.

OnShowWindow

Notifies container when object becomes visible or invisible.

RequestNewObjectLayout

Asks container to resize display site.

 

SaveObject

 

FUNCTION IOleClientSite_SaveObject ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IOleClientSite_SaveObject (pthis) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetMoniker

 

FUNCTION IOleClientSite_GetMoniker ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL dwWhichMoniker AS DWORD _

, BYREF ppmk AS DWORD _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IOleClientSite_GetMoniker (pthis, dwWhichMoniker, ppmk) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

GetContainer

 

FUNCTION IOleClientSite_GetContainer ( _

  BYVAL pthis AS DWORD PTR _

, BYREF ppContainer AS DWORD _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING IOleClientSite_GetContainer (pthis, ppContainer) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

ShowObject

 

FUNCTION IOleClientSite_ShowObject ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[6] USING IOleClientSite_ShowObject (pthis) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

OnShowWindow

 

FUNCTION IOleClientSite_OnShowWindow ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL fShow AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IOleClientSite_OnShowWindow (pthis, fShow) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

RequestNewObjectLayout

 

FUNCTION IOleClientSite_RequestNewObjectLayout ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[7] USING IOleClientSite_RequestNewObjectLayout (pthis) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

IOleClientSite interface implementation

 


$IID_IOleClientSite = GUID$("{00000118-0000-0000-C000-000000000046}")

' ****************************************************************************************
' IOleClientSite interface
' ****************************************************************************************
TYPE IOleClientSiteVtbl
   ' IUnknown methods
   pQueryInterface          AS DWORD          ' // QueryInterface method
   pAddRef                  AS DWORD          ' // AddRef method
   pRelease                 AS DWORD          ' // Release method
   ' IOleClientSite members
   pSaveObject              AS DWORD          ' // SaveObject method
   pGetMoniker              AS DWORD          ' // GetMoniker method
   pGetContainer            AS DWORD          ' // GetContainer method
   pShowObject              AS DWORD          ' // ShowObject method
   pOnShowWindow            AS DWORD          ' // OnShowWindow method
   pRequestNewObjectLayout  AS DWORD          ' // OnFocus method
   ' Custom data
   pVtblAddr                AS DWORD          ' // Address of the virtual table
   cRef                     AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the IOleClientSite Virtual Table
' Returns a cookie that is a pointer to a IOleClientSiteVtbl structure.
' ****************************************************************************************
FUNCTION IOleClientSite_BuildVtbl () AS DWORD

   LOCAL pVtbl AS IOleClientSiteVtbl PTR
   LOCAL pUnk AS IOleClientSiteVtbl PTR

   pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
   IF pVtbl = 0 THEN EXIT FUNCTION

   @pVtbl.pQueryInterface          = CODEPTR(IOleClientSite_QueryInterface)
   @pVtbl.pAddRef                  = CODEPTR(IOleClientSite_AddRef)
   @pVtbl.pRelease                 = CODEPTR(IOleClientSite_Release)

   @pVtbl.pSaveObject              = CODEPTR(IOleClientSite_SaveObject)
   @pVtbl.pGetMoniker              = CODEPTR(IOleClientSite_GetMoniker)
   @pVtbl.pGetContainer            = CODEPTR(IOleClientSite_GetContainer)
   @pVtbl.pShowObject              = CODEPTR(IOleClientSite_ShowObject)
   @pVtbl.pOnShowWindow            = CODEPTR(IOleClientSite_OnShowWindow)
   @pVtbl.pRequestNewObjectLayout  = CODEPTR(IOleClientSite_RequestNewObjectLayout)

   @pVtbl.pVtblAddr                = pVtbl
   @pVtbl.cRef                     = 1

   pUnk = VARPTR(@pVtbl.pVtblAddr)
   FUNCTION = pUnk

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IOleClientSite_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION IOleClientSite_QueryInterface (BYVAL pCookie AS IOleClientSiteVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
   IF riid = $IID_IOleClientSite THEN
      ppvObj = pCookie
      INCR @@pCookie.cRef
      FUNCTION = %S_OK
   ELSE
      FUNCTION = %E_NOINTERFACE
   END IF
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IOleClientSite_AddRef method
' Increments the reference counter.
' ****************************************************************************************
FUNCTION IOleClientSite_AddRef (BYVAL pCookie AS IOleClientSiteVtbl PTR) AS DWORD
   INCR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' IOleClientSite_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IOleClientSite_Release (BYVAL pCookie AS IOleClientSiteVtbl PTR) AS DWORD
   DECR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
   IF @@pCookie.cRef = 0 THEN
      IF ISTRUE @@pCookie.pVtblAddr THEN
         HeapFree(GetProcessHeap(), 0, BYVAL @@pCookie.pVtblAddr)
      END IF
   END IF
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Saves embedded object.
' ****************************************************************************************
FUNCTION IOleClientSite_SaveObject (BYVAL pCookie AS IOleClientSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Requests object's moniker.
' ****************************************************************************************
FUNCTION IOleClientSite_GetMoniker (BYVAL pCookie AS IOleClientSiteVtbl PTR, BYVAL dwWhichMoniker AS DWORD, BYREF ppmk AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Requests pointer to object's container.
' ****************************************************************************************
FUNCTION IOleClientSite_GetContainer (BYVAL pCookie AS IOleClientSiteVtbl PTR, BYREF ppContainer AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Asks container to display object.
' ****************************************************************************************
FUNCTION IOleClientSite_ShowObject (BYVAL pCookie AS IOleClientSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies container when object becomes visible or invisible.
' ****************************************************************************************
FUNCTION IOleClientSite_OnShowWindow (BYVAL pCookie AS IOleClientSiteVtbl PTR, BYVAL fShow AS LONG) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Asks container to resize display site.
' ****************************************************************************************
FUNCTION IOleClientSite_RequestNewObjectLayout (BYVAL pCookie AS IOleClientSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Friday, 17 March 2006 22:15:10 +0100