%SYNMSW_PRINTQUERY
Retrieve printer characteristics
WSupported on Windows
|
|
|
NSupported in Synergy .NET
|
status = %SYNMSW_PRINTQUERY(subfunction, info_record)
or
xcall SYNMSW_PRINTQUERY(subfunction, info_record)
Return value
status
%SYNMSW_PRINTQUERY returns true if successful, and it returns false if unsuccessful (if the specified printer is not found). If D_ENUM_PRINTERS or D_ENUM_WITH_INFO is specified, a value of -1 (D_EOLIST) is returned if there are no more printers configured in the print manager. (^VAL)
Arguments
subfunction
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.
info_record
Returned with a structure containing printer characteristics. (a)
Discussion
The %SYNMSW_PRINTQUERY function 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)
Because Windows requires support for 256 character printer names, 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)
In Synergy .NET, %SYNMSW_PRINTQUERY requires the main program to have the [STAThread] attribute. %SYNMSW_PRINTQUERY is not thread safe, so you should ensure that only one thread at a time uses it. |