Home COM GDI+ WebBrowser Data Access

IContinueCallback Interface

 

IID_IContinueCallback

{B722BCCA-4E68-101B-A2BC-00AA00404770}

 

 

The IContinueCallback interface is a generic callback mechanism for interruptible processes that should periodically ask an object whether to continue.

 

The FContinue method is a generic continuation request. FContinuePrinting carries extra information pertaining to a printing process and is used in the context of IPrint.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IContinueCallback Methods

Description

FContinue

Answers whether an operation should continue.

FContinuePrinting

Answers whether a printing operation should continue.

 

FContinue

 

FUNCTION IContinueCallback_FContinue ( _

  BYVAL pthis AS DWORD PTR _

  ) AS LONG

 
' Return value:
  ' %S_OK Continue the operation.
  ' %E_FALSE Cancel the operation as soon as possible.


END FUNCTION

 

 

FContinuePrinting

 

FUNCTION IContinueCallback_FContinuePrinting ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL nCntPrinted AS LONG _

, BYVAL nCurPage AS LONG _

, BYVAL pwszPrintStatus AS DWORD _

  ) AS LONG

 
' Return value:
  ' %S_OK Continue the operation.
  ' %E_FALSE Cancel the operation as soon as possible.
  ' %E_UNEXPECTED An error occurred.


END FUNCTION

 

 

Implementation

 

$IID_IContinueCallback = GUID$("{b722bcca-4e68-101b-a2bc-00aa00404770}")

' *** IContinueCallback interface ***
TYPE TB_ICONTINUECALLBACK
   ' IUnknown methods
   pQueryInterface AS DWORD    ' // QueryInterface method
   pAddRef AS DWORD            ' // AddRef method
   pRelease AS DWORD           ' // Release method
   ' IContinueCallback methods
   pFContinue AS DWORD         ' // FContinue method
   pFContinuePrinting AS DWORD ' // FContinuePrinting method
   ' Custom data
   pVtblAddr AS DWORD          ' // Address of the virtual table
   cRef AS DWORD               ' // Reference count
END TYPE

' *** Builds the IUnknown Virtual Table ***
FUNCTION NEW_TB_IContinueCallback () AS DWORD

   LOCAL pVtbl AS TB_ICONTINUECALLBACK PTR
   LOCAL pUnk AS TB_ICONTINUECALLBACK PTR

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

   @pVtbl.pQueryInterface = CODEPTR(IConitnueCallback_QueryInterface)
   @pVtbl.pAddRef = CODEPTR(IContinueCallback_AddRef)
   @pVtbl.pRelease = CODEPTR(IContinueCallback_Release)
   @pVtbl.pFContinue = CODEPTR(IContinueCallback_FContinue)
   @pVtbl.pFContinuePrinting = CODEPTR(IContinueCallback_FContinuePrinting)

   @pVtbl.pVtblAddr = pVtbl
   @pVtbl.cRef = 0

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

END FUNCTION

' IContinueCallback_AddRef method
' Increments the reference counter.

FUNCTION IContinueCallback_AddRef (BYVAL pCookie AS TB_ICONTINUECALLBACK PTR) AS DWORD
 

   INCR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
 

END FUNCTION

' IContinueCallback_QueryInterface method
' Returns the IUnknown of our class and increments the reference counter.

FUNCTION IContinueCallback_QueryInterface (BYVAL pCookie AS TB_ICONTINUECALLBACK PTR, BYREF riid AS GUID, BYREF ppvObj AS DWORD) AS LONG
 

   IF riid = $IID_IContinueCallback THEN
      ppvObj = pCookie
      INCR @@pCookie.cRef
      FUNCTION = %S_OK
   ELSE
      FUNCTION = %E_NOTIMPL
   END IF
 

END FUNCTION

' IContinueCallback_Release method
' Releases our class if there is only a reference to him and decrements the reference counter.

FUNCTION IContinueCallback_Release (BYVAL pCookie AS TB_ICONTINUECALLBACK PTR) AS DWORD
 

   DECR @@pCookie.cRef
   FUNCTION = @@pCookie.cRef
   IF @@pCookie.cRef = 0 THEN
      IF ISTRUE @@pCookie.pVtblAddr THEN
         @@pCookie.@pData.pIDispatch = %NULL
         HeapFree(GetProcessHeap(), 0, BYVAL @@pCookie.pVtblAddr)
      END IF
   END IF
 

END FUNCTION

' FContinue method
' Answers whether an operation should continue.

FUNCTION IContinueCallback_FContinue (BYVAL pCookie AS TB_ICONTINUECALLBACK PTR) AS LONG

   ' Return value:
   ' %S_OK Continue the operation.
   ' %E_FALSE Cancel the operation as soon as possible.


END FUNCTION

' FContinuePrinting method
' Answers whether a printing operation should continue.

FUNCTION IContinueCallback_FContinuePrinting (BYVAL pCookie AS TB_ICONTINUECALLBACK PTR, BYVAL nCntPrinted AS LONG, BYVAL nCurPage AS LONG, BYVAL pwszPrintStatus AS DWORD) AS LONG

   ' Return value:
   ' %S_OK Continue the operation.
   ' %E_FALSE Cancel the operation as soon as possible.
   ' %E_UNEXPECTED An error occurred.


END FUNCTION

 

 

Page last updated on Monday, 03 April 2006 20:24:37 +0200