Retrieve printer characteristics

WTSupported in traditional Synergy on Windows
WNSupported in Synergy .NET on Windows



status = %U_PRINTQUERY(subfunction, info_record)


xcall U_PRINTQUERY(subfunction, info_record)

Return value


On Windows, true if successful, and false if unsuccessful (if the specified printer is not found). If D_ENUM_PRINTERS or D_ENUM_WITH_INFO is specified on Windows, a value of -1 (D_EOLIST) is returned if there are no more printers configured in the print manager. On UNIX and OpenVMS, always returns false. (^VAL)



One of the following: (n)


Return info about a specific printer.


Return the next printer ID.


Return the next printer ID and its information.


Reset D_ENUM_PRINTERS to its initial state.


Returned with a structure containing printer characteristics. (a)


%U_PRINTQUERY retrieves information about the currently selected printer or a specified printer from your Windows Print Manager. It can also retrieve the names of all printers configured in your Windows Print Manager. The info_record format is

record info_record
  lpp           ,i4     ;Lines per page
  cpl           ,i4     ;Characters per line
  flags         ,i4     ;Miscellaneous flags
  unused        ,a20    ;Reserved space
  printerid     ,a80    ;For pre-7.5 compatibility
  driver        ,a32    ;Printer driver name
  extprinterid  ,a256   ;Extended printer name and port(s)

Windows requires support for 256 character printer names. Because of this, you must use the extprinterid field, added in version 7.5, rather than printerid on Windows.

If D_DEVICEINFO is specified, info_record is returned with information about the printer designated by printerid. If printerid is blank, information on the currently selected printer is returned.

If D_ENUM_PRINTERS is specified, printerid is filled in with the name of the next printer from the Windows Print Manager list of installed printers. The first call retrieves the ID for the first installed printer, the second call retrieves the ID for the second installed printer, etc. When all printer IDs have been returned through this function, a call to D_ENUM_PRINTERS returns D_EOLIST, and printerid is cleared. (The next call to D_ENUM_PRINTERS will return the first printer ID again.)

D_ENUM_WITH_INFO works in the same way as D_ENUM_PRINTERS: the first call returns information on the first printer in the list, and so forth. But with D_ENUM_WITH_INFO, the entire info_record is returned.

If D_ENUM_RESET is specified, the D_ENUM_PRINTERS function is reset with the next D_ENUM_PRINTERS call returning the first printer ID.

The flags field contains bit flags for various printer characteristics. To test a flag, use .band. with the .defined value from tools.def. Currently, we provide the flag for proportional spacing only. To test for proportional spacing, use

proportional = (info_record.flags .band. D_PRT_PROPORTIONAL)