How to Specify Num of Copies w/ Common Dialog or Escape() APILast reviewed: June 21, 1995Article ID: Q78165 |
The information in this article applies to:
- Professional Edition of Microsoft Visual Basic for Windows, versions 2.0 and 3.0- Microsoft Visual Basic programming system for Windows, version 1.0
SUMMARYYou can use the Common Dialog in the Professional Edition of Visual Basic version 2.0 or 3.0, or you can call the Windows API Escape() function in other versions to tell the Windows Print Manager how many copies of a document you want to print.
MORE INFORMATIONThe Windows API constant SETCOPYCOUNT (value 17) can be used as an argument to the Escape() function to specify the number of uncollated copies of each page for the printer to print. The arguments for Escape() are as follows: r% = Escape(hDC, SETCOPYCOUNT, Len(Integer), lpNumCopies, lpActualCopies)
Parameter Type/Description hDC hDC. Identifies the device context. Usually referenced by Printer.hDC. lpNumCopies Long pointer to integer (not ByVal). Point to a short-integer value that contains the number of uncollated copies to print. lpActualCopies Long pointer to integer (not ByVal). Points to a short integer value that will receive the number of copies that where printed. This may be less than the number requested if the requested number is greater than the device's maximum copy count.The return value specifies the outcome of the escape -- 1 if the escape is successful, a negative number if the escape is not successful, or zero if the escape is not supported. The following example code demonstrates how to print three copies of a line of text on the printer. To re-create this example, choose New Project from the Visual Basic File menu. Then add a command button to the form and paste the following code into the appropriate event procedures: REM Below is GLOBAL.BAS:
' The following Declare statement must be typed on one, single line: Declare Function Escape% Lib "GDI" (ByVal hDc%, ByVal nEsc%, ByVal nLen%, lpData%, lpOut%)REM Below is the click procedure for a command button on Form1:
Sub Command1_Click () Const SETCOPYCOUNT = 17 Printer.Print "" x% = Escape(Printer.hDC, SETCOPYCOUNT, Len(I%), 3, actual%) Printer.Print " Printing three copies of this" Printer.EndDoc End Sub |
Additional reference words: 1.00 2.00 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |