WINPRINT-SETUP-EX

Usage

CALL "WIN$PRINTER" 
     USING WINPRINT-SETUP-EX WPRTDATA-SETUP-EX-FLAGS.
or
        CALL "WIN$PRINTER" USING WINPRINT-SETUP-EX.

Parameters

This op-code has an optional parameter (described in winprint.def):

  • WPRTDATA-SETUP-EX-FLAGS - This parameter may be set to one of these values:
    WPRT-PRINTTOFILE (32) By setting this, the Print To File checkbox is checked when the dialog is shown, which means when you open the print, a file save dialog will automatically show. You can also see this if, after this call, you use the WINPRINT-GET-CURRENT-INFO-EX to update the content of WINPRINT-SELECTION, in which case the WINPRINT-PORT will contain the string FILE:. Note that if you want to print to file and do not want to have the dialog show, set the environment variable WIN-SPOOLER-PORT to a filename of your choice prior to the OPEN statement. Note that this file does not have to exist, but it must be a valid filename. If it does exist, it will be overwritten. This flag may be combined with WPRT-DISABLEPRINTTOFILE, for example:
    ADD 32 524288 GIVING WPRTDATA-SETUP-EX-FLAGS
    WPRT-DISABLEPRINTTOFILE (524288) By setting this, the Print to File checkbox will show, but appears disabled so the user cannot change it. This flag may be combined with WPRT-PRINTTOFILE, for example:
    ADD 32 524288 GIVING WPRTDATA-SETUP-EX-FLAGS
    WPRT-HIDEPRINTTOFILE (1048576)

    This will remove the Print to File checkbox, so it will not appear on the printer selection dialog.

Description

This op-code is used to invoke the Microsoft SDK PrintDlgEx printer dialog. Note that this printer dialog is considered a more modern and feature-rich function than its predecessors (PrintDlg, PageSetup) and is fully supported on Windows Vista.

Comments

This op-code requires Windows 2000 or later; if you try to execute this call on a machine equipped with Win9x, WinME, or Win NT of any version, it will return the error code:

WPRTERR-UNSUPPORTED (0)

It also requires that the application display a window prior to the call of this op-code. If your application has not displayed a window and you call this op-code, the following error code is returned:

WPRTERR-WINDOW-REQUIRED (-14)

This works also in thin client environments. Note that in thin client environments, Windows print will occur on the client side with the resources available to the client.

If you experience problems with execution, use the A-TRACE environment variable. By setting this and a trace file, both the return code from the dialog and the COM error that may have happened will be written to the trace file.