Home COM GDI+ WebBrowser Data Access

IMAPIAdviseSink Interface

 

IID_IMAPIAdviseSink

{00020302-0000-0000-C000-000000000046}

 

 

The IMAPIAdviseSink interface is used to implement an advise sink object for handling notification. A pointer to an advise sink object is passed in a call to a service provider's Advise method, the mechanism used to register for notification.

 

 


' ****************************************************************************************
' IMAPIAdviseSink interface
' $IID_IMAPIAdviseSink = GUID$("{00020302-0000-0000-C000-000000000046}")
' The IMAPIAdviseSink interface is used to implement an advise sink object for handling
' notification. A pointer to an advise sink object is passed in a call to a service
' provider's Advise method, the mechanism used to register for notification.
' ****************************************************************************************

' ========================================================================================
' IUnknown virtual table
' ========================================================================================
TYPE IMAPIAdviseSink_IUnknownVtbl
   ' IUnknown interface
   QueryInterface AS DWORD           ' Returns pointers to supported interfaces
   AddRef AS DWORD                   ' Increments reference count
   Release AS DWORD                  ' Decrements reference count
   ' IMAPIAdviseSink interface
   OnNotify AS DWORD                 ' OnNotify method
   ' Custom data
   pVtblAddr AS DWORD                ' Address of the virtual table
   cRef AS DWORD                     ' Reference counter
   pthis AS DWORD                    ' IUnknown of the control that fires the events
END TYPE
' ========================================================================================

' ========================================================================================
' Builds the IUnknown Virtual Table
' ========================================================================================
FUNCTION IMAPIAdviseSink_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD

   LOCAL pVtbl AS IMAPIAdviseSink_IUnknownVtbl PTR
   LOCAL pUnk AS IMAPIAdviseSink_IUnknownVtbl PTR

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

   @pVTbl.QueryInterface        = CODEPTR(IMAPIAdviseSink_QueryInterface)
   @pVTbl.AddRef                = CODEPTR(IMAPIAdviseSink_AddRef)
   @pVTbl.Release               = CODEPTR(IMAPIAdviseSink_Release)
   @pVTbl.OnNotify              = CODEPTR(IMAPIAdviseSink_OnNotify)
   @pVtbl.pVtblAddr             = pVtbl
   @pVtbl.pthis                 = pthis

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

END FUNCTION
' ========================================================================================

' ========================================================================================
' UI4 AddRef()
' Increments the reference counter.
' ========================================================================================
FUNCTION IMAPIAdviseSink_AddRef (BYVAL pIMAPIAdviseSink AS IMAPIAdviseSink_IUnknownVtbl PTR) AS DWORD
   INCR @@pIMAPIAdviseSink.cRef
   FUNCTION = @@pIMAPIAdviseSink.cRef
END FUNCTION
' ========================================================================================

' ========================================================================================
' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
' Returns the IUnknown of our class and increments the reference counter.
' ========================================================================================
FUNCTION IMAPIAdviseSink_QueryInterface (BYVAL pIMAPIAdviseSink AS IMAPIAdviseSink_IUnknownVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS DWORD
   ppvObj = pIMAPIAdviseSink
   IMAPIAdviseSink_AddRef pIMAPIAdviseSink
   FUNCTION = %S_OK
END FUNCTION
' ========================================================================================

' ========================================================================================
' UI4 Release()
' Releases our class if there is only a reference to him and decrements the reference counter.
' ========================================================================================
FUNCTION IMAPIAdviseSink_Release (BYVAL pIMAPIAdviseSink AS IMAPIAdviseSink_IUnknownVtbl PTR) AS DWORD
   LOCAL pVtblAddr AS DWORD
   IF @@pIMAPIAdviseSink.cRef = 1 THEN
      pVtblAddr = @@pIMAPIAdviseSink.pVtblAddr
      IF ISTRUE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
         FUNCTION = 0
         EXIT FUNCTION
      ELSE
         FUNCTION = @@pIMAPIAdviseSink.cRef
         EXIT FUNCTION
      END IF
   END IF
   DECR @@pIMAPIAdviseSink.cRef
   FUNCTION = @@pIMAPIAdviseSink.cRef
END FUNCTION
' ========================================================================================

' ========================================================================================
' IMAPIAdviseSink::OnNotify
' The IMAPIAdviseSink::OnNotify method responds to a notification by performing one or
' more tasks. The tasks performed depend on the object generating the notification and
' type of event.
' ========================================================================================
FUNCTION IMAPIAdviseSink_OnNotify ( _
  BYVAL pIMAPIAdviseSink AS IMAPIAdviseSink_IUnknownVtbl PTR _
, BYVAL cNotif AS DWORD _
, BYVAL lpNotifications AS DWORD _
  ) AS LONG


   ' *** Put your code here ***

   FUNCTION = %S_OK

END FUNCTION
' ========================================================================================
 

 

Page last updated on Monday, 03 April 2006 20:13:49 +0200