Home COM GDI+ WebBrowser Data Access

ITimerSink  Interface

 

IID_ITimerSink

{3050F361-98B5-11CF-BB82-00AA00BDCE0B}

 

 

This interface implements a method that is called by the timer service for a scheduled event.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

ITimerSink Members

Description

OnTimer

Called by the timer service for a scheduled event.

 

ITimerSink interface implementation

 


$IID_ITimerSink = GUID$("{3050F361-98B5-11CF-BB82-00AA00BDCE0B}")

' ****************************************************************************************
' ITimerSink interface
' ****************************************************************************************
TYPE ITimerSinkVtbl
   ' IUnknown methods
   pQueryInterface         AS DWORD          ' // QueryInterface method
   pAddRef                 AS DWORD          ' // AddRef method
   pRelease                AS DWORD          ' // Release method
   ' ITimerSink members
   pOnTimer                AS DWORD          ' // OnTimer method
   ' Custom data
   pVtblAddr               AS DWORD          ' // Address of the virtual table
   cRef                    AS DWORD          ' // Reference count
END TYPE
' ****************************************************************************************

' ****************************************************************************************
' Builds the ITimerSink Virtual Table
' Returns a cookie that is a pointer to a ITimerSinkVtbl structure.
' ****************************************************************************************
FUNCTION ITimerSink_BuildVtbl () AS DWORD

   LOCAL pVtbl AS ITimerSinkVtbl PTR
   LOCAL pUnk AS ITimerSinkVtbl PTR

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

   @pVtbl.pQueryInterface         = CODEPTR(ITimerSink_QueryInterface)
   @pVtbl.pAddRef                 = CODEPTR(ITimerSink_AddRef)
   @pVtbl.pRelease                = CODEPTR(ITimerSink_Release)

   @pVtbl.pOnTimer                = CODEPTR(ITimerSink_OnTimer)

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

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

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

' ****************************************************************************************
' ITimerSink_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.
' ****************************************************************************************
FUNCTION ITimerSink_QueryInterface (BYVAL pCookie AS ITimerSinkVtbl PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
   IF riid = GUID$("{00000000-0000-0000-C000-000000000046}") OR riid = $IID_ITimerSink THEN
      ppvObj = pCookie
      ITimerSink_AddRef pCookie
      FUNCTION = %S_OK
   ELSE
      FUNCTION = %E_NOINTERFACE
   END IF
END FUNCTION
' ****************************************************************************************

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

' ****************************************************************************************
' Called by the timer service for a scheduled event.
' ****************************************************************************************
FUNCTION ITimerSink_OnTimer (BYVAL pCookie AS ITimerSinkVtbl PTR, BYVAL vtimeAdvise AS VARIANT) AS LONG
   ' Put your code here
   ' FUNCTION = %S_OK
END FUNCTION
' ****************************************************************************************
 

 

Page last updated on Tuesday, 14 March 2006 06:53:28 +0100