ID Number: Q78165
1.00
WINDOWS
Summary:
You can call the Windows API Escape function to tell the Windows Print
Manager how many copies of a document you want to print.
This information applies to Microsoft Visual Basic programming system
version 1.0 for Windows.
More Information:
The 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. It is 1 if the
escape is successful; it is a negative number if the escape is not
successful. If the escape is not supported, the return value is zero.
The following sample will demonstrate how to print three copies of a
line of text to the printer. To recreate this example, create a new
project from the Visual Basic File menu and add a command button.
Paste the following code into the appropriate code sections of your
program:
REM Below is GLOBAL.BAS:
'Note: the following Declare must be on one 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
Const NULL = 0&
Printer.Print ""
x% = Escape(Printer.hDC, SETCOPYCOUNT, Len(I%), 0, 3)
Printer.Print " Printing three copies of this"
Printer.EndDoc
End Sub
Additional reference words: 1.00