Home COM GDI+ WebBrowser Data Access

IOleInPlaceSite Interface

 

IID_IOleInPlaceSite

{00000119-0000-0000-C000-000000000046}

 

 

The IOleInPlaceSite interface manages interaction between the container and the object's in-place client site. Recall that the client site is the display site for embedded objects, and provides position and conceptual information about the object.

 

This interface provides methods that manage in-place objects. With IOleInPlaceSite, you can determine if an object can be activated and manage its activation and deactivation. You can notify the container when one of its objects is being activated and inform the container that a composite menu will replace the container's regular menu. It provides methods that make it possible for the in-place object to retrieve the window object hierarchy, and the position in the parent window where the object should place its in-place activation window. Finally, it determines how the container scrolls the object, manages the object undo state, and notifies the object when its borders have changed.

 

Use this interface to allow your object to control in-place activation from within the container.

 

The IOleInPlaceSite interface pointer is obtained by calling QueryInterface on the object's IOleClientSite interface.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IOleWindow Methods

Description

GetWindow

Gets a window handle.

ContextSensitiveHelp

Controls enabling of context-sensitive help.

IOleInPlaceSite Methods

Description

CanInPlaceActivate

Determines if the container can activate the object in place.

OnInPlaceActivate

Notifies the container that one of its objects is being activated in place.

OnUIActivate

Notifies the container that the object is about to be activated in place, and that the main menu will be replaced by a composite menu.

GetWindowContext

Enables an in-place object to retrieve window interfaces that form at the window object hierarchy, and the position in the parent window to locate the object's in-place activation window.

Scroll

Specifies the number of pixels by which the container is to scroll the object.

OnUIDeactivate

Notifies the container to reinstall its user interface and take focus.

OnInPlaceDeactivate

Notifies the container that the object is no longer active in place.

DiscardUndoState

Instructs the container to discard its undo state.

DeactivateAndUndo

Deactivate the object and revert to undo state.

OnposRectChange

Object's extents have changed.

 

CanInPlaceActivate

 

FUNCTION IOleInPlaceSite_CanInPlaceActivate ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

OnInPlaceActivate

 

FUNCTION IOleInPlaceSite_OnInPlaceActivate ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

OnUIActivate

 

FUNCTION IOleInPlaceSite_OnUIActivate ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

GetWindowContext

 

FUNCTION IOleInPlaceSite_GetWindowContext ( _

  BYVAL pthis AS DWORD PTR _

, BYREF ppFrame AS DWORD _

, BYREF ppDoc AS DWORD _

, BYREF lprcPosRect AS RECT _

, BYREF lprcClipRect AS RECT _

, BYREF lpFrameInfo AS DWORD _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[8] USING IOleInPlaceSite_GetWindowContext (pthis, ppFrame, ppDoc, lprcPosRect, lprcClipRect, lpFrameInfo) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Scroll

 

FUNCTION IOleInPlaceSite_Scroll ( _

  BYVAL pthis AS DWORD PTR _

, BYREF scrollExtant AS apiSIZE _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[9] USING IOleInPlaceSite_Scroll (pthis, scrollExtant) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

OnUIDeactivate

 

FUNCTION IOleInPlaceSite_OnUIDeactivate ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL fUndoable AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[10] USING IOleInPlaceSite_OnUIDeactivate (pthis, fUndoable) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

OnInPlaceDeactivate

 

FUNCTION IOleInPlaceSite_OnInPlaceDeactivate ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

DiscardUndoState

 

FUNCTION IOleInPlaceSite_DiscardUndoState ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

DeactivateAndUndo

 

FUNCTION IOleInPlaceSite_DeactivateAndUndo ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

OnPosRectChange

 

FUNCTION IOleInPlaceSite_OnPosRectChange ( _

  BYVAL pthis AS DWORD PTR _

, BYREF lprcPosRect AS RECT _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[14] USING IOleInPlaceSite_OnPosRectChange (pthis, lprcPosRect) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

IOleInPlaceSite interface implementation

 


$IID_IOleInPlaceSite = GUID$("{00000119-0000-0000-C000-000000000046}")

' ****************************************************************************************
' IOleInPlaceSite interface
' ****************************************************************************************
TYPE IOleInPlaceSiteVtbl
   ' IUnknown methods
   pQueryInterface          AS DWORD          ' // QueryInterface method
   pAddRef                  AS DWORD          ' // AddRef method
   pRelease                 AS DWORD          ' // Release method
   ' IOleWindow  members
   pGetWindow               AS DWORD          ' // GetWindow method
   pContextSensitiveHelp    AS DWORD          ' // GetWindow method
   ' IOleInPlaceSite members
   pCanInPlaceActivate      AS DWORD          ' // CanInPlaceActivate method
   pOnInPlaceActivate       AS DWORD          ' // OnInPlaceActivate method
   pOnUIActivate            AS DWORD          ' // OnUIActivate method
   pGetWindowContext        AS DWORD          ' // GetWindowContext method
   pScroll                  AS DWORD          ' // Scroll method
   pOnUIDeactivate          AS DWORD          ' // OnUIDeactivate method
   pOnInPlaceDeactivate     AS DWORD          ' // OnInPlaceDeactivate method
   pDiscardUndoState        AS DWORD          ' // DiscardUndoState method
   pDeactivateAndUndo       AS DWORD          ' // DeactivateAndUndo method
   pOnposRectChange         AS DWORD          ' // OnposRectChange method
   ' Custom data
   pVtblAddr                AS DWORD          ' // Address of the virtual table
   cRef                     AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the IOleInPlaceSite Virtual Table
' Returns a cookie that is a pointer to a IOleInPlaceSiteVtbl structure.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_BuildVtbl () AS DWORD

   LOCAL pVtbl AS IOleInPlaceSiteVtbl PTR
   LOCAL pUnk AS IOleInPlaceSiteVtbl PTR

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

   @pVtbl.pQueryInterface          = CODEPTR(IOleInPlaceSite_QueryInterface)
   @pVtbl.pAddRef                  = CODEPTR(IOleInPlaceSite_AddRef)
   @pVtbl.pRelease                 = CODEPTR(IOleInPlaceSite_Release)

   @pVtbl.pGetWindow               = CODEPTR(IOleInPlaceSite_GetWindow)
   @pVtbl.pContextSensitiveHelp    = CODEPTR(IOleInPlaceSite_ContextSensitiveHelp)
   @pVtbl.pCanInPlaceActivate      = CODEPTR(IOleInPlaceSite_CanInPlaceActivate)
   @pVtbl.pOnInPlaceActivate       = CODEPTR(IOleInPlaceSite_OnInPlaceActivate)
   @pVtbl.pOnUIActivate            = CODEPTR(IOleInPlaceSite_OnUIActivate)
   @pVtbl.pGetWindowContext        = CODEPTR(IOleInPlaceSite_GetWindowContext)
   @pVtbl.pScroll                  = CODEPTR(IOleInPlaceSite_Scroll)
   @pVtbl.pOnUIDeactivate          = CODEPTR(IOleInPlaceSite_OnUIDeactivate)
   @pVtbl.pOnInPlaceDeactivate     = CODEPTR(IOleInPlaceSite_OnInPlaceDeactivate)
   @pVtbl.pDiscardUndoState        = CODEPTR(IOleInPlaceSite_DiscardUndoState)
   @pVtbl.pDeactivateAndUndo       = CODEPTR(IOleInPlaceSite_DeactivateAndUndo)
   @pVtbl.pOnposRectChange         = CODEPTR(IOleInPlaceSite_OnposRectChange)

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

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

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

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

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

' ****************************************************************************************
' IOleInPlaceSite_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_Release (BYVAL pCookie AS IOleInPlaceSiteVtbl 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
' ****************************************************************************************

' ****************************************************************************************
' Gets a window handle.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_GetWindow (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR, BYREF phwnd AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Controls enabling of context-sensitive help.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_ContextSensitiveHelp (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR, BYVAL fEnterMode AS LONG) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Determines if the container can activate the object in place.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_CanInPlaceActivate (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies the container that one of its objects is being activated in place.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_OnInPlaceActivate (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies the container that the object is about to be activated in place, and that the
' main menu will be replaced by a composite menu.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_OnUIActivate (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Enables an in-place object to retrieve window interfaces that form at the window object
' hierarchy, and the position in the parent window to locate the object's in-place
' activation window.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_GetWindowContext (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR, BYREF ppFrame AS DWORD, BYREF ppDoc AS DWORD, BYREF lprcPosRect AS RECT, BYREF lprcClipRect AS RECT, BYREF lpFrameInfo AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Specifies the number of pixels by which the container is to scroll the object.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_Scroll (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR, BYREF scrollExtant AS apiSIZE) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies the container to reinstall its user interface and take focus.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_OnUIDeactivate (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR, BYVAL fUndoable AS LONG) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies the container that the object is no longer active in place.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_OnInPlaceDeactivate (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Instructs the container to discard its undo state.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_DiscardUndoState (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Deactivate the object and revert to undo state.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_DeactivateAndUndo (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Object's extents have changed.
' ****************************************************************************************
FUNCTION IOleInPlaceSite_OnposRectChange (BYVAL pCookie AS IOleInPlaceSiteVtbl PTR, BYREF lprcPosRect AS RECT) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Monday, 03 April 2006 20:32:22 +0200