Error Handling

When you call WIN$PRINTER, it returns a status value. This numeric value is returned in the CALL statement's GIVING data item, or the special register RETURN-CODE if no GIVING item is specified. A positive value indicates that the routine succeeded. A value of zero or less indicates that an error or exception occurred. These situations have level 78 values defined for them in winprint.def. The defined values include:

WPRTERR-BAD-ARG This code indicates an unknown operation code or illegal value for any of the WIN$PRINTER functions.
WPRTERR-BAD-DRIVER This code is returned when the spooler can't find a device driver that corresponds to the selected printer.
WPRTERR-BUFFER-TOO-SMALL This code is returned when the data item passed to the WINPRINT-GET-SETTINGS operation is too small to hold the spooler's current configuration.
WPRTERR-CANCELLED This code is returned when you use the WINPRINT-SETUP or WINPRINT-SETUP-USE-MARGINS operation to display the printer setup dialog box and the user clicks the Cancel button or closes the dialog box without clicking the OK button. This status can usually be ignored because the runtime automatically restores the prior configuration.
WPRTERR-DEVICE-INCAPABLE This code is returned when you try to print a bitmap and the printer you are using cannot print bitmaps.
WPRTERR-DRV-LOADFAIL This code is returned when WIN$PRINTER failed to load the driver information for the chosen printer. This could be caused by a corrupted file, bad registry settings, or a remote printer being offline.
WPRTERR-ENUM-FAIL This code is returned when one of the WIN$PRINTER functions does not find any available printers on the system.
WPRTERR-NO-MEMORY This code indicates that the system ran out of memory when trying to perform the requested operation.
WPRTERR-SPOOLER-CLOSED This code is returned when you attempt to print a bitmap on a closed print file.
WPRTERR-SPOOLER-OPEN This code indicates that the program tried to change the spooler's configuration while a spooled print file was open.
WPRTERR-SPOOL-ERR This code is returned when there is an error in the Graphical Device Interface (GDI) layer that is not listed in winprint.def. Use the operation WINPRINT-GET-SPOOL-ERR to obtain the exact Windows API code and refer to your Windows SDK documentation for a description.
WPRTERR-UNSUPPORTED This code is returned whenever WIN$PRINTER is called on a machine that is not a Windows machine.

Usage

CALL "WIN$PRINTER"
    USING WINPRINT-GET-SETTINGS-SIZE
    GIVING RESULT

Return Values

This operation returns the number of bytes needed to hold the current spooler configuration.

Description

The spooler configuration includes the destination device, paper size, and page orientation. It does not include the current font selection. Use this operation to ensure that you have a large enough buffer when using the WINPRINT-GET-SETTINGS and WINPRINT-SET-SETTINGS operations.

Note: This operation is not supported in Acucorp's Thin Client environment.