WINPRINT-SETUP

This operation code calls the standard Windows Setup Printer dialog box. This allows the user to select which printer to use, the desired page orientation (landscape or portrait), and the desired paper size and source. To also get the page margins, use WINPRINT-SETUP-USE-MARGINS instead. Note that there is also a WINPRINT-SETUP-EX operation code for calling the PrintDlgEx function, which is considered a more modern and feature-rich printer dialog box and is fully supportd in Windows Vista.

In Windows Vista, Microsoft no longer fully supports the PrintDlg function, which leaves the function relatively useless. This in turn limits the functionality of WINPRINT-SETUP, which is used to call PrintDlg.

To minimize the impact on users of WINPRINT-SETUP, the runtime detects when it is executed on placeVista and will change to use the new WINPRINT-SETUP-EX operation code that is used to display the PrintDlgEx printer window.

Note that the application must have a window open in order for this feature to work. If no window is open, the printer dialog will not be shown, the error WPRTERR-WINDOW-REQUIRED will be returned, and the print job may go to the default printer.

Usage

CALL "WIN$PRINTER"
    USING WINPRINT-SETUP
    GIVING RESULT

Description

The runtime internally configures itself based on the selections chosen by the user. These become the settings used during the remainder of the run or until the next call to this operation. Settings return to their defaults when the runtime exits.

If you are using the WINPRINT-SELECTION data structure, calls to WINPRINT-SETUP must also be followed by a call to WINPRINT-GET-CURRENT-INFO(-EX) to ensure consistency between COBOL data storage information and the current Windows configuration. However, if you do not use any of the operation codes that rely on the WINPRINT-SELECTION group, there is no need to call WINPRINT-GET-CURRENT-INFO(-EX).

Note: Changing the output device with this operation will reset any columns you have set using WINPRINT-COLUMN op-codes.