Home COM GDI+ WebBrowser Data Access

IAdviseSinkEx Interface

 

IID_IAdviseSinkEx

{3AF24290-0C96-11CE-A0CF-00AA00600AB8}

 

 

The IAdviseSinkEx interface is derived from IAdviseSink to provide extensions for notifying the sink of changes in an object's view status.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IAdviseSink Methods

Description

OnDataChange

Advises that data has changed.

OnViewChange

Advises that view of object has changed.

OnRename

Advises that name of object has changed.

OnSave

Advises that object has been saved to disk.

OnClose

Advises that object has been closed.

IAdviseSinkEx Method

Description

OnViewStatusChange

Notifies the sink that a view status of an object has changed.

 

IAdviseSinkEx interface implementation

 


$IID_IAdviseSinkEx = GUID$("{3AF24290-0C96-11CE-A0CF-00AA00600AB8}")

UNION STGMEDIUMDATA
   hBitmap AS DWORD
   hMetaFilePict AS DWORD
   hEnhMetaFile AS DWORD
   hGlobal AS DWORD
   lpszFileName AS DWORD
   pstm AS DWORD
   pstg AS DWORD
END UNION

TYPE STGMEDIUM
   tymed AS DWORD
   tsmd AS STGMEDIUMDATA
   pUnkForRelease AS DWORD
END TYPE
 
TYPE DVTARGETDEVICE
   tdSize AS DWORD
   tdDriverNameOffset AS WORD
   tdDeviceNameOffset AS WORD
   tdPortNameOffset AS WORD
   tdExtDevmodeOffset AS WORD
   tdData(0) AS BYTE
END TYPE

TYPE FORMATETC
   cfFormat AS DWORD
   ptd AS DVTARGETDEVICE PTR
   dwAspect AS DWORD
   lindex AS LONG
   tymed AS DWORD
END TYPE


' ****************************************************************************************
' IAdviseSinkEx interface
' ****************************************************************************************
TYPE IAdviseSinkExVtbl
   ' IUnknown methods
   pQueryInterface         AS DWORD          ' // QueryInterface method
   pAddRef                 AS DWORD          ' // AddRef method
   pRelease                AS DWORD          ' // Release method
   ' IAdviseSink methods
   pOnDataChange           AS DWORD          ' // OnDataChange method
   pOnViewChange           AS DWORD          ' // OnViewChange method
   pOnRename               AS DWORD          ' // OnRename method
   pOnsave                 AS DWORD          ' // OnSave method
   pOnClose                AS DWORD          ' // OnClose method
   ' IAdviseSinkEx method
   pOnViewStatusChange     AS DWORD          ' // OnViewStatusChange method
   ' Custom data
   pVtblAddr               AS DWORD          ' // Address of the virtual table
   cRef                    AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the IAdviseSinkEx Virtual Table
' Returns a cookie that is a pointer to a IAdviseSinkExVtbl structure.
' ****************************************************************************************
FUNCTION IAdviseSinkEx_BuildVtbl () AS DWORD

   LOCAL pVtbl AS IAdviseSinkExVtbl PTR
   LOCAL pUnk AS IAdviseSinkExVtbl PTR

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

   @pVtbl.pQueryInterface         = CODEPTR(IAdviseSinkEx_QueryInterface)
   @pVtbl.pAddRef                 = CODEPTR(IAdviseSinkEx_AddRef)
   @pVtbl.pRelease                = CODEPTR(IAdviseSinkEx_Release)

   @pVtbl.pOnDataChange           = CODEPTR(IAdviseSinkEx_OnDataChange)
   @pVtbl.pOnViewChange           = CODEPTR(IAdviseSinkEx_OnViewChange)
   @pVtbl.pOnRename               = CODEPTR(IAdviseSinkEx_OnRename)
   @pVtbl.pOnSave                 = CODEPTR(IAdviseSinkEx_OnSave)
   @pVtbl.pOnClose                = CODEPTR(IAdviseSinkEx_OnClose)
   @pVtbl.pOnViewStatusChange     = CODEPTR(IAdviseSinkEx_OnViewStatusChange)

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

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

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

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

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

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

' ****************************************************************************************
' Advises that data has changed.
' ****************************************************************************************
SUB  IAdviseSinkEx_OnDataChange (BYVAL pCookie AS IAdviseSinkExVtbl PTR, BYREF pformatetc AS FORMATETC, BYREF pStgmed AS STGMEDIUM)
   ' Put your code here
END SUB
' ****************************************************************************************

' ****************************************************************************************
' Advises that view of object has changed.
' ****************************************************************************************
SUB  IAdviseSinkEx_OnViewChange (BYVAL pCookie AS IAdviseSinkExVtbl PTR, BYVAL dwAspect AS DWORD, BYVAL lindex AS LONG)
   ' Put your code here
END SUB
' ****************************************************************************************

' ****************************************************************************************
' Advises that name of object has changed.
' ****************************************************************************************
SUB  IAdviseSinkEx_OnRename (BYVAL pCookie AS IAdviseSinkExVtbl PTR, BYVAL pmk AS DWORD)
   ' Put your code here
END SUB
' ****************************************************************************************

' ****************************************************************************************
' Advises that object has been saved to disk.
' ****************************************************************************************
SUB  IAdviseSinkEx_OnSave (BYVAL pCookie AS IAdviseSinkExVtbl PTR)
   ' Put your code here
END SUB
' ****************************************************************************************

' ****************************************************************************************
' Advises that object has been closed.
' ****************************************************************************************
SUB  IAdviseSinkEx_OnClose (BYVAL pCookie AS IAdviseSinkExVtbl PTR)
   ' Put your code here
END SUB
' ****************************************************************************************

' ****************************************************************************************
' Notifies the sink that a view status of an object has changed.
' ****************************************************************************************
FUNCTION  IAdviseSinkEx_OnViewStatusChange (BYVAL pCookie AS IAdviseSinkExVtbl PTR, BYVAL dwViewStatus AS DWORD) AS LONG
   ' Put your code here
END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Monday, 03 April 2006 20:28:39 +0200