Home COM GDI+ WebBrowser Data Access

IMAPIViewAdviseSink Interface

 

IID_IMAPIViewAdviseSink

{0002032B-0000-0000-C000-000000000046}

 

 

The IMAPIViewAdviseSink interface is used by form viewers to receive notifications from forms.

 

 


' ****************************************************************************************
' IMAPIViewAdviseSink interface
' $IID_IMAPIViewAdviseSink = GUID$("{0002032B-0000-0000-C000-000000000046}")
' Used by form viewers to receive notifications from forms.
' ****************************************************************************************

' ========================================================================================
' IUnknown virtual table
' ========================================================================================
TYPE IMAPIViewAdviseSink_IUnknownVtbl
   ' IUnknown interface
   QueryInterface AS DWORD           ' Returns pointers to supported interfaces
   AddRef AS DWORD                   ' Increments reference count
   Release AS DWORD                  ' Decrements reference count
   ' IMAPIViewAdviseSink interface
   OnShutdown AS DWORD               ' OnShutdown method
   OnNewMessage AS DWORD             ' OnNewMessage method
   OnPrint AS DWORD                  ' OnPrint method
   OnSubmitted AS DWORD              ' OnSubmitted method
   OnSaved AS DWORD                  ' OnSaved 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 IMAPIViewAdviseSink_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD

   LOCAL pVtbl AS IMAPIViewAdviseSink_IUnknownVtbl PTR
   LOCAL pUnk AS IMAPIViewAdviseSink_IUnknownVtbl PTR

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

   @pVTbl.QueryInterface        = CODEPTR(IMAPIViewAdviseSink_QueryInterface)
   @pVTbl.AddRef                = CODEPTR(IMAPIViewAdviseSink_AddRef)
   @pVTbl.Release               = CODEPTR(IMAPIViewAdviseSink_Release)
   @pVTbl.OnShutdown            = CODEPTR(IMAPIViewAdviseSink_OnShutdown)
   @pVTbl.OnNewMessage          = CODEPTR(IMAPIViewAdviseSink_OnNewMessage)
   @pVTbl.OnPrint               = CODEPTR(IMAPIViewAdviseSink_OnPrint)
   @pVTbl.OnSubmitted           = CODEPTR(IMAPIViewAdviseSink_OnSubmitted)
   @pVTbl.OnSaved               = CODEPTR(IMAPIViewAdviseSink_OnSaved)
   @pVtbl.pVtblAddr             = pVtbl
   @pVtbl.pthis                 = pthis

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

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

' ========================================================================================
' UI4 AddRef()
' Increments the reference counter.
' ========================================================================================
FUNCTION IMAPIViewAdviseSink_AddRef (BYVAL pIMAPIViewAdviseSink AS IMAPIViewAdviseSink_IUnknownVtbl PTR) AS DWORD
   INCR @@pIMAPIViewAdviseSink.cRef
   FUNCTION = @@pIMAPIViewAdviseSink.cRef
END FUNCTION
' ========================================================================================

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

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

' ========================================================================================
' IMAPIViewAdviseSink::OnShutdown
' Notifies the form viewer that a form is being closed.
' ========================================================================================
FUNCTION IMAPIViewAdviseSink_OnShutdown ( _
  BYVAL pIMAPIViewAdviseSink AS IMAPIViewAdviseSink_IUnknownVtbl PTR _
) AS LONG

   ' *** Put your code here ***

' Return Values
' %S_OK  The notification succeeded.

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

' ========================================================================================
' IMAPIViewAdviseSink::OnNewMessage
' Notifies the form viewer that either a new or an existing message has been loaded in a form.
' ========================================================================================
FUNCTION IMAPIViewAdviseSink_OnNewMessage ( _
  BYVAL pIMAPIViewAdviseSink AS IMAPIViewAdviseSink_IUnknownVtbl PTR _
) AS LONG

   ' *** Put your code here ***

' Return Values
' %S_OK  The notification succeeded.

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

' ========================================================================================
' IMAPIViewAdviseSink::OnPrint
' Notifies the form viewer of the printing status of a form.
' ========================================================================================
FUNCTION IMAPIViewAdviseSink_OnPrint ( _
  BYVAL pIMAPIViewAdviseSink AS IMAPIViewAdviseSink_IUnknownVtbl PTR _
) AS LONG

   ' *** Put your code here ***

' Return Values
' %S_OK  The notification succeeded.
' %MAPI_E_USER_CANCEL The user canceled the operation, typically by clicking the Cancel
' button in a dialog box.

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

' ========================================================================================
' IMAPIViewAdviseSink::OnSubmitted
' Notifies the form viewer that the current message has been submitted to the MAPI spooler.
' ========================================================================================
FUNCTION IMAPIViewAdviseSink_OnSubmitted ( _
  BYVAL pIMAPIViewAdviseSink AS IMAPIViewAdviseSink_IUnknownVtbl PTR _
) AS LONG

   ' *** Put your code here ***

' Return Values
' %S_OK  The notification succeeded.

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

' ========================================================================================
' IMAPIViewAdviseSink::OnSaved
' notifies the form viewer that the current message in a form has been saved.
' ========================================================================================
FUNCTION IMAPIViewAdviseSink_OnSaved ( _
  BYVAL pIMAPIViewAdviseSink AS IMAPIViewAdviseSink_IUnknownVtbl PTR _
) AS LONG

   ' *** Put your code here ***

' Return Values
' %S_OK  The call succeeded and has returned the expected value or values.

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

 

Page last updated on Monday, 03 April 2006 20:16:44 +0200