Home COM GDI+ WebBrowser Data Access

IPrint Interface

 

IID_IPrint

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

 

 

The IPrint interface enables compound documents in general and active documents in particular to support programmatic printing. Once a document is loaded, containers and other clients can call IPrint::Print to instruct a document to print itself, specifying printing control flags, the target device, the particular pages to print, and other options. The client can control the continuation of printing by calling the IContinueCallback interface.

 

An object that implements IPrint registers itself with the Printable key stored under its CLSID as follows:

 

HKEY_CLASSES_ROOT\CLSID\{...}\Printable

 

Callers determine whether a particular object class supports programmatic printing of its persistent state by looking in the registry for this key.

 

 

Methods in VTable order

IUnknown Methods

Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments reference count.

Release

Decrements reference count.

IPrint Methods

Description

SetInitialPageNum

Sets number of first page.

GetPageInfo

Obtains number of pages and number of first page.

Print

Prints object's persistent state.

 

PRINTFLAG Enumeration

 

' Indicates that the printing process can interact with the user.

%PRINTFLAG_MAYBOTHERUSER = 1

' Indicates the normal print dialog box must be used.
%PRINTFLAG_PROMPTUSER = 2

' The user may change the printer.
%PRINTFLAG_USERMAYCHANGEPRINTER = 4

' The document must recompose itself to the printer.
%PRINTFLAG_RECOMPOSETODEVICE = 8

' Only simulate printing.
%PRINTFLAG_DONTACTUALLYPRINT = 16

' Force properties
%PRINTFLAG_FORCEPROPERTIES = 32

' Print to a file.
%PRINTFLAG_PRINTTOFILE = 64

 

 

SetInitialPageNum

 

FUNCTION IPrint_SetInitialPageNum ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL nFirstPage AS LONG _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[3] USING IPrint_SetInitialPageNum (pthis, nFirstPage) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

GetPageInfo

 

FUNCTION IPrint_GetPageInfo ( _

  BYVAL pthis AS DWORD PTR _

, BYREF nFirstPage AS LONG _

, BYREF pcPages AS LONG _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[4] USING IPrint_GetPageInfo (pthis, nFirstPage, pcPages) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

Print

 

FUNCTION IPrint_Print ( _

  BYVAL pthis AS DWORD PTR _

, BYVAL grfFlags AS DWORD _

, BYREF pptd AS DVTARGETDEVICE _

, BYREF pstgmOptions AS STGMEDIUM _

, BYVAL pcallback AS DWORD _

, BYVAL nFirstPage AS LONG _

, BYREF pcPagesPrinted AS LONG _

, BYREF pnLastPage AS LONG _

  ) AS LONG
 

  LOCAL HRESULT AS LONG
  CALL DWORD @@pthis[5] USING IPrint_Print (pthis, grfFlags, pptd, pstgmOptions, pcallback, nFirstPage, pcPagesPrinted, pnLastPage) TO HRESULT
  FUNCTION = HRESULT


END FUNCTION

 

 

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