|
|
|
ISpoolerHook Interface |
|
IID_ISpoolerHook |
{00020320-0000-0000-C000-000000000046} |
|
The ISpoolerHook interface enables a messaging hook provider to process messages before they go to their destination. This processing can include modifying the message, changing the list of recipients, saving a copy of the message elsewhere, and so on.
|
' ****************************************************************************************
' ISpoolerHook interface
' $IID_ISpoolerHook = GUID$("{00020320-0000-0000-C000-000000000046}")
' The ISpoolerHook interface enables a messaging hook provider to process messages before
' they go to their destination. This processing can include modifying the message,
' changing the list of recipients, saving a copy of the message elsewhere, and so on.
' ****************************************************************************************
' ========================================================================================
' IUnknown virtual table
' ========================================================================================
TYPE ISpoolerHook_IUnknownVtbl
' IUnknown interface
QueryInterface AS DWORD ' Returns pointers to supported interfaces
AddRef AS DWORD ' Increments reference count
Release AS DWORD ' Decrements reference count
' ISpoolerHook interface
InboundMsgHook AS DWORD ' InboundMsgHook method
OutboundMsgHook AS DWORD ' OutboundMsgHook 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 ISpoolerHook_BuildVtbl (BYVAL pthis AS DWORD) AS DWORD
LOCAL pVtbl AS ISpoolerHook_IUnknownVtbl PTR
LOCAL pUnk AS ISpoolerHook_IUnknownVtbl PTR
pVtbl = HeapAlloc(GetProcessHeap(), %HEAP_ZERO_MEMORY, SIZEOF(@pVtbl))
IF pVtbl = 0 THEN EXIT FUNCTION
@pVTbl.QueryInterface = CODEPTR(ISpoolerHook_QueryInterface)
@pVTbl.AddRef = CODEPTR(ISpoolerHook_AddRef)
@pVTbl.Release = CODEPTR(ISpoolerHook_Release)
@pVTbl.InboundMsgHook = CODEPTR(ISpoolerHook_InboundMsgHook)
@pVTbl.OutboundMsgHook = CODEPTR(ISpoolerHook_OutboundMsgHook)
@pVtbl.pVtblAddr = pVtbl
@pVtbl.pthis = pthis
pUnk = VARPTR(@pVtbl.pVtblAddr)
FUNCTION = pUnk
END FUNCTION
' ========================================================================================
' ========================================================================================
' UI4 AddRef()
' Increments the reference counter.
' ========================================================================================
FUNCTION ISpoolerHook_AddRef (BYVAL pISpoolerHook AS ISpoolerHook_IUnknownVtbl PTR) AS DWORD
INCR @@pISpoolerHook.cRef
FUNCTION = @@pISpoolerHook.cRef
END FUNCTION
' ========================================================================================
' ========================================================================================
' HRESULT QueryInterface([in] *GUID riid, [out] **VOID ppvObj)
' Returns the IUnknown of our class and increments the reference counter.
' ========================================================================================
FUNCTION ISpoolerHook_QueryInterface (BYVAL pISpoolerHook AS ISpoolerHook_IUnknownVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS DWORD
ppvObj = pISpoolerHook
ISpoolerHook_AddRef pISpoolerHook
FUNCTION = %S_OK
END FUNCTION
' ========================================================================================
' ========================================================================================
' UI4 Release()
' Releases our class if there is only a reference to him and decrements the reference counter.
' ========================================================================================
FUNCTION ISpoolerHook_Release (BYVAL pISpoolerHook AS ISpoolerHook_IUnknownVtbl PTR) AS DWORD
LOCAL pVtblAddr AS DWORD
IF @@pISpoolerHook.cRef = 1 THEN
pVtblAddr = @@pISpoolerHook.pVtblAddr
IF ISTRUE HeapFree(GetProcessHeap(), 0, BYVAL pVtblAddr) THEN
FUNCTION = 0
EXIT FUNCTION
ELSE
FUNCTION = @@pISpoolerHook.cRef
EXIT FUNCTION
END IF
END IF
DECR @@pISpoolerHook.cRef
FUNCTION = @@pISpoolerHook.cRef
END FUNCTION
' ========================================================================================
' ========================================================================================
' ISpoolerHook::InboundMsgHook
' The ISpoolerHook::InboundMsgHook method is called by the MAPI spooler. The method can
' perform arbitrary processing on an inbound message and can change the message's delivery
' point from the Inbox to another folder.
' ========================================================================================
FUNCTION ISpoolerHook_InboundMsgHook ( _
BYVAL pISpoolerHook AS ISpoolerHook_IUnknownVtbl PTR _
, BYVAL lpMessage AS DWORD _
, BYVAL lpFolder AS DWORD _
, BYVAL lpMDB AS DWORD _
, BYREF lpulFlags AS DWORD _
, BYREF lpcbEntryID AS DWORD _
, BYREF lppEntryID AS DWORD _
) AS LONG
' *** Put your code here ***
' Return Values
' %S_OK The call succeeded and has returned the expected value or values.
END FUNCTION
' ========================================================================================
' ========================================================================================
' ISpoolerHook::OutboundMsgHook
' The ISpoolerHook::OutboundMsgHook method is called by the MAPI spooler to process
' outgoing messages. This processing can include archiving the message in a Sent Items
' folder, modifying the message, and so on.
' ========================================================================================
FUNCTION ISpoolerHook_OutboundMsgHook ( _
BYVAL pISpoolerHook AS ISpoolerHook_IUnknownVtbl PTR _
, BYVAL lpMessage AS DWORD _
, BYVAL lpFolder AS DWORD _
, BYVAL lpMDB AS DWORD _
, BYREF lpulFlags AS DWORD _
, BYREF lpcbEntryID AS DWORD _
, BYREF lppEntryID AS DWORD _
) 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:18:52 +0200