Home COM GDI+ WebBrowser Data Access

IOleInPlaceSiteEx Interface

 

IID_IOleInPlaceSiteEx

{9C2CAD80-3424-11CF-B670-00AA004CD6D8}

 

 

The IOleInPlaceSiteEx interface provides an additional set of activation and deactivation notification methods that enable an object to avoid unnecessary flashing on the screen when the object is activated and deactivated.

 

When an object is activated, it does not know if its visual display is already correct. When the object is deactivated, the container does not know if the visual display is correct. To avoid a redraw and the associated screen flicker in both cases, the container can provide this extension to IOleInPlaceSite.

 

An embedded object, such as a control, calls the methods in this interface to determine if it needs to redraw itself on activation and to notify the container if the object needs to be redrawn on deactivation. By avoiding the redraw when it is not needed, you can reduce the amount of flashing on the screen.

 

If the site object does not support IOleInPlaceSiteEx, the object must call methods in the IOleInPlaceSite interface instead. In this case, the object must redraw itself on activation and deactivation.

 

 

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.

IOleInPlaceSiteEx Methods

Description

OnInPlaceActivateEx

Called by the embedded object to determine if it needs to redraw itself upon activation.

OnInplaceDeactivateEx

Notifies the container of whether the object needs to be redrawn upon deactivation.

RequestUIActivate

Notifies the container that the object is about to enter the UI-active state.

 

OnInPlaceActivateEx

 

FUNCTION IOleInPlaceSiteEx_OnInPlaceActivateEx ( _

  BYVAL pthis AS DWORD PTR _

, BYREF pfNoRedraw AS LONG _

, BYVAL dwFlags AS DWORD _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[15] USING IOleInPlaceSiteEx_OnInPlaceActivateEx (pthis, pfNoRedraw, dwFlags) TO HRESULT
  FUNCTION = HRESULT

END FUNCTION

 

 

OnInPlaceDeactivateEx

 

FUNCTION IOleInPlaceSiteEx_OnInPlaceDeactivateEx ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL fNoRedraw AS LONG _

  ) AS LONG

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[16] USING IOleInPlaceSiteEx_OnInPlaceDeactivateEx (pthis, fNoRedraw) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

RequestUIActivate

 

FUNCTION IOleInPlaceSiteEx_RequestUIActivate ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

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


END FUNCTION

 

 

IOleInPlaceSiteEx interface implementation

 


$IID_IOleInPlaceSiteEx = GUID$("{9C2CAD80-3424-11CF-B670-00AA004CD6D8}")

' ****************************************************************************************
' IOleInPlaceSiteEx interface
' ****************************************************************************************
TYPE IOleInPlaceSiteExVtbl
   ' 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
   ' IOleInPlaceSiteEx members
   pOnInPlaceActivateEx     AS DWORD          ' // OnInPlaceActivateEx method
   pOnInplaceDeactivateEx   AS DWORD          ' // OnInplaceDeactivateEx method
   pRequestUIActivate       AS DWORD          ' // RequestUIActivate method
   ' Custom data
   pVtblAddr                AS DWORD          ' // Address of the virtual table
   cRef                     AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the IOleInPlaceSiteEx Virtual Table
' Returns a cookie that is a pointer to a IOleInPlaceSiteExVtbl structure.
' ****************************************************************************************
FUNCTION IOleInPlaceSiteEx_BuildVtbl () AS DWORD

   LOCAL pVtbl AS IOleInPlaceSiteExVtbl PTR
   LOCAL pUnk AS IOleInPlaceSiteExVtbl PTR

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

   @pVtbl.pQueryInterface          = CODEPTR(IOleInPlaceSiteEx_QueryInterface)
   @pVtbl.pAddRef                  = CODEPTR(IOleInPlaceSiteEx_AddRef)
   @pVtbl.pRelease                 = CODEPTR(IOleInPlaceSiteEx_Release)

   @pVtbl.pGetWindow               = CODEPTR(IOleInPlaceSiteEx_GetWindow)
   @pVtbl.pContextSensitiveHelp    = CODEPTR(IOleInPlaceSiteEx_ContextSensitiveHelp)
   @pVtbl.pCanInPlaceActivate      = CODEPTR(IOleInPlaceSiteEx_CanInPlaceActivate)
   @pVtbl.pOnInPlaceActivate       = CODEPTR(IOleInPlaceSiteEx_OnInPlaceActivate)
   @pVtbl.pOnUIActivate            = CODEPTR(IOleInPlaceSiteEx_OnUIActivate)
   @pVtbl.pGetWindowContext        = CODEPTR(IOleInPlaceSiteEx_GetWindowContext)
   @pVtbl.pScroll                  = CODEPTR(IOleInPlaceSiteEx_Scroll)
   @pVtbl.pOnUIDeactivate          = CODEPTR(IOleInPlaceSiteEx_OnUIDeactivate)
   @pVtbl.pOnInPlaceDeactivate     = CODEPTR(IOleInPlaceSiteEx_OnInPlaceDeactivate)
   @pVtbl.pDiscardUndoState        = CODEPTR(IOleInPlaceSiteEx_DiscardUndoState)
   @pVtbl.pDeactivateAndUndo       = CODEPTR(IOleInPlaceSiteEx_DeactivateAndUndo)
   @pVtbl.pOnposRectChange         = CODEPTR(IOleInPlaceSiteEx_OnposRectChange)
   @pVtbl.pOnInPlaceActivateEx     = CODEPTR(IOleInPlaceSiteEx_OnInPlaceActivateEx)
   @pVtbl.pOnInplaceDeactivateEx   = CODEPTR(IOleInPlaceSiteEx_OnInplaceDeactivateEx)
   @pVtbl.pRequestUIActivate       = CODEPTR(IOleInPlaceSiteEx_RequestUIActivate)

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

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

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

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

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

' ****************************************************************************************
' IOleInPlaceSiteEx_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.
' ****************************************************************************************
FUNCTION IOleInPlaceSiteEx_Release (BYVAL pCookie AS IOleInPlaceSiteExVtbl 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 IOleInPlaceSiteEx_GetWindow (BYVAL pCookie AS IOleInPlaceSiteExVtbl PTR, BYREF phwnd AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

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

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

' ****************************************************************************************
' Notifies the container that one of its objects is being activated in place.
' ****************************************************************************************
FUNCTION IOleInPlaceSiteEx_OnInPlaceActivate (BYVAL pCookie AS IOleInPlaceSiteExVtbl 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 IOleInPlaceSiteEx_OnUIActivate (BYVAL pCookie AS IOleInPlaceSiteExVtbl 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 IOleInPlaceSiteEx_GetWindowContext (BYVAL pCookie AS IOleInPlaceSiteExVtbl 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 IOleInPlaceSiteEx_Scroll (BYVAL pCookie AS IOleInPlaceSiteExVtbl 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 IOleInPlaceSiteEx_OnUIDeactivate (BYVAL pCookie AS IOleInPlaceSiteExVtbl 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 IOleInPlaceSiteEx_OnInPlaceDeactivate (BYVAL pCookie AS IOleInPlaceSiteExVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

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

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

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

' ****************************************************************************************
' Called by the embedded object to determine if it needs to redraw itself upon activation.
' ****************************************************************************************
FUNCTION IOleInPlaceSiteEx_OnInPlaceActivateEx (BYVAL pCookie AS IOleInPlaceSiteExVtbl PTR, BYREF pfNoRedraw AS LONG, BYVAL dwFlags AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies the container of whether the object needs to be redrawn upon deactivation.
' ****************************************************************************************
FUNCTION IOleInPlaceSiteEx_OnInplaceDeactivateEx (BYVAL pCookie AS IOleInPlaceSiteExVtbl PTR, BYVAL fNoRedraw AS LONG) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Notifies the container that the object is about to enter the UI-active state.
' ****************************************************************************************
FUNCTION IOleInPlaceSiteEx_RequestUIActivate (BYVAL pCookie AS IOleInPlaceSiteExVtbl PTR) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************
 

 

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