Progress
Report Builder
Deployment Guide


Identifying the Default Printer

You can identify the current default printer and port for MS-Windows from the Progress 4GL using the aderb/_prdef.p procedure. This procedure is useful for assigning printers at run time.

Use the following command in the Progress 4GL application:

RUN aderb/_prdef.p (OUTPUT printer-name, OUTPUT port-name, 
      OUTPUT success) 

The following list describes the arguments for the _prdef.p procedure:

printer-name

The character variable that will receive the name of the printer.

port-name

The character variable that will receive the name of the port.

success

The logical variable that gets assigned a TRUE value (yes) if Progress returns a string of zero or more characters and a FALSE value if no string is returned.

For example, run the defprint.p procedure:

defprint.p
/* 1 */ 
  DEF VAR printer AS CHARACTER FORMAT "x(45)".
  DEF VAR port AS CHARACTER FORMAT "x(20)".
  DEF VAR success AS LOGICAL.

/* 2 */ 
  RUN aderb/_prdef.p (OUTPUT printer, OUTPUT port, OUTPUT success).

/* 3 */ 
  IF success THEN DO:
    DISPLAY printer port.
    PAUSE.
  END
  ELSE MESSAGE "_prdef failed" VIEW-AS ALERT-BOX ERROR. 

The commented numbers correspond to the following step-by-step descriptions:

  1. Define the variables that will display the printer name and port name. Also define a logical variable that will test whether the printer information is available. If the procedure returns a string, _prdef.p sets the variable to True; if no string is returned, _prdef.p sets the variable to False.
  2. Call the _prdef.p procedure and specify the printer, port, and logical variables.
  3. Test the value in the success variable, then display the appropriate information.

Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095