WINPRINT-GET-PRINTER-INFO

This operation code retrieves information about a particular printer. It does not alter any of the current printer settings.

Usage

CALL "WIN$PRINTER"
    USING WINPRINT-GET-PRINTER-INFO, 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

Device names up to 80 characters in length will be stored. If a name is wider than 80 characters, it will be truncated from the rightmost position. These names may contain embedded spaces. The following information will be returned:

WINPRINT-NAME Holds the name of the selected printer as given in the Printers folder under Settings.
WINPRINT-PORT Holds the name of the selected port (or UNC address) as given in the properties of the printer.
WINPRINT-DRIVER Holds the name of the assigned driver as seen in the properties of the printer. Note that for remote printers, this name will almost always be given as winspool.
WINPRINT-DRV-VERSION Holds the version number of the driver for the requested printer.
WINPRINT-NO-OF-PRINTERS Holds the number of the current printer. Remember, this number is based on the order of printers in the computer's internal printer list, and may change from time to time. It is not recommended to identify a printer by number unless you first enumerate the printers by calling WINPRINT-GET-NO-PRINTERS.
WINPRINT-IS-DEFAULT Holds the value of 1 if the printer is the Windows default printer, otherwise it is set to 0.
WINPRINT-COPIES Holds the maximum number of copies the printer is able to provide. The most common value is 99. If a printer is not copy capable, it will have the value of 1.
WINPRINT-CURR-COPIES Returns the current number of copies the driver is set to print. Note that some printers return a value of 1, indicating that the original is copy number 1. Other printers appear to return a value of 0, indicating an original plus 0 copies. You can change this value to the number of copies you wish to print.
WINPRINT-QUALITY Returns the current setting for the varying grades of print quality.

This value applies to dot-matrix printers. Most inkjet and laser printers do not support this method of determining the level of print quality.

WINPRINT-ORIENTATION

Holds a value indicating the orientation ability of the printer. If portrait and landscape modes are supported, this value is set to 1. If only portrait mode is supported, it is set to 0.

WINPRINT-CURR-ORIENTATION Returns the current orientation set in the driver, if portrait mode is active, the value is set to 1. If landscape mode is active, the value is set to 2. A value of 0 uses the printer's default setting. You can change this value to set the orientation you prefer.

Description

Calling the op-code WINPRINT-GET-NO-PRINTERS before calling WINPRINT-GET-PRINTER-INFO is recommended. However, it is not necessary to perform WINPRINT-GET-NO-PRINTERS each time you run WINPRINT-GET-PRINTER-INFO. You can perform the operation once and store the data until it is needed.

Note: If you want to retrieve information about all the printers on the system, start with a value of 1 in WINPRINT-NO-OF-PRINTERS in the WINPRINT-SELECTION record. Increment this value by one for each new execution until a negative value is returned.