WINPRINT-SETUP-EX

Usage

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

Parameters

WPRTDATA-SETUP-EX=FLAGS Group item defined in winprint.def as follows:
05 WPRTDATA-SETUP-EX-FLAGS         PIC 9(9) COMP-5 SYNC.
   88 WPRT-PRINTTOFILE             VALUE 32.
   88 WPRT-DISABLEPRINTTOFILE      VALUE 524288.
   88 WPRT-HIDEPRINTTOFILE
WPRTDATA-SETUP-EX-PARENTWND Use this parameter when using a window handle. Its value is a parent window.

Description

This op-code is used to invoke the Microsoft SDK PrintDlgEx printer dialog. This printer dialog is considered a more modern and feature-rich function than its predecessors (PrintDlg, PageSetup).

WPRTDATA-SETUP-EX=FLAGS has the following 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.

Comments

This op-code 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.