WINPRINT-GET-PRINTER-STATUS

This operation code allows you to check the current status of a printer. This can be used to see if a printer is available to perform a print job or not.

In some cases the printer may respond that it is ready when, in fact, there are jobs pending because the printer is out of paper or paused. (This is a feature of the Windows API.) We recommend that you check condition of the printer using the WINPRINT-JOB-STATUS operation codes.

Usage

CALL "WIN$PRINTER"
    USING WINPRINT-GET-PRINTER-STATUS, WINPRINT-SELECTION
    GIVING RESULT

Parameters

WINPRINT-SELECTION Group item defined in winprint.def as follows:
01 WINPRINT-SELECTION.
   03 WINPRINT-NAME                    PIC X(80).
   03 WINPRINT-PORT                    PIC X(80).
   03 WINPRINT-DRIVER                  PIC X(80).
   03 WINPRINT-DRV-VERSION             SIGNED-INT.
   03 WINPRINT-NO-OF-PRINTERS          SIGNED-SHORT.
      88 WPRTERR-NO-PRINTERS           VALUE -1.
   03 WINPRINT-IS-DEFAULT              SIGNED-SHORT.
      88 WPRT-IS-NOT-DEFAULT           VALUE 0.
      88 WPRT-IS-DEFAULT               VALUE 1.
   03 WINPRINT-COPIES                  SIGNED-SHORT.
      88 WPRT-HAS-NO-COPY              VALUE 1.
   03 WINPRINT-ORIENTATION             SIGNED-SHORT.
      88 WPRT-HAS-NO-LANDSCAPE         VALUE 0.
      88 WPRT-HAS-LANDSCAPE            VALUE 1.
   03 WINPRINT-QUALITY                 SIGNED-SHORT.
   03 WINPRINT-CURR-ORIENTATION        SIGNED-SHORT.
   03 WINPRINT-CURR-COPIES             SIGNED-SHORT.

Return Values

This operation returns the printer status as defined in the Windows API.

A great variety of conditions can affect a single print job and printer status may be the result of a combination of values. This makes it impossible to catalog all possible status settings in winprint.def. Refer to the Windows API documentation for a description of any status not covered in that file.

Description

This operation may be called any time, whether the printer is open or not. There is no need to reset this function. WINPRINT-SELECTION should be initialized prior to use. WINPRINT-NAME must be set to the name of the desired printer. WINPRINT-NAME passes the printer name as an input variable. Printer settings are not modified by this operation.

Note: If this function is executed on a networked printer with a missing or malfunctioning network, your application may appear to hang. Once the timeout has completed, your application will resume. This is a feature of the Windows API, not an effect of the runtime.