Stores information about available printers, print servers, domains, or print providers into an array.
APrintersEx(cArrayName [, cName [, nFlags [, nLevel [, nOutputType]]]])
Parameters
- cArrayName
if nLevel = 1
the array contains the following information from the PRINTER_INFO_1 structure. Column Content Datatype 1 Flags. Have a look here PRINTER_INFO_1 for a list of possible values. N 2 Describes the contents of the structure. C 3 Names the contents of the structure. C 4 Additional data describing the structure. C
if nLevel = 2the array contains the following information from the PRINTER_INFO_2 structure. Column Content Datatype 1 The server that controls the printer. If this string is empty, the printer is controlled locally. C 2 The name of the printer. C 3 The share point for the printer. C 4 The port(s) used to transmit data to the printer. C 5 The name of the printer driver. C 6 A brief description of the printer. C 7 Specifies the physical location of the printer C 8 The name of the file used to create the separator page. This page is used to separate print jobs sent to the printer. C 9 The name of the print processor used by the printer. C 10 The data type used to record the print job. C 11 The default print-processor parameters. C 12 The printer attributes. For a list of possible values have a look here PRINTER_INFO_2. N 13 A priority value that the spooler uses to route print jobs. N 14 The default priority value assigned to each print job. N 15 The earliest time at which the printer will print a job.
This value is expressed as minutes elapsed since 12:00 AM GMT (Greenwich Mean Time).N 16 The latest time at which the printer will print a job.
This value is expressed as minutes elapsed since 12:00 AM GMT (Greenwich Mean Time).N 17 The printer status. For a list of possible values have a look here PRINTER_INFO_2. C 18 The number of print jobs that have been queued for the printer. N 19 The average number of pages per minute that have been printed on the printer. N
if nLevel = 4the array contains the following information from the PRINTER_INFO_4 structure. Column Content Datatype 1 The name of the printer (local or remote). C 2 The name of the server. C 3 Attributes. For a list of possible values have a look here PRINTER_INFO_4. N
if nLevel = 5the array contains the following information from the PRINTER_INFO_5 structure. Column Content Datatype 1 The name of the printer. C 2 The port(s) used to transmit data to the printer. C 3 The printer attributes. For a list of possible values have a look here PRINTER_INFO_5. N 4 DeviceNotSelectedTimeout N 5 TransmissionRetryTimeout N
- cName (optional)
default = empty
Name of the print processor, domain or server for which to enumerater printers.
if nLevel is 1, nFlags contains PRINTER_ENUM_NAME and cName is not empty, then cName specifies the name of the object to enumerate.
This string can be the name of a server, a domain, or a print provider.
if nLevel is 1, nFlags contains PRINTER_ENUM_NAME, and cName is empty, then the function enumerates the available print providers.
if nLevel is 1, nFlags contains PRINTER_ENUM_REMOTE, and cName is empty, then the function enumerates the printers in the user's domain.
If nLevel is 2 or 5, cName specifies the name of a server whose printers are to be enumerated. If cName is empty, then the function enumerates the printers installed on the local machine.
If nLevel is 4, cName should be empty. The function always queries on the local machine.
When cName is empty, setting nFlags to PRINTER_ENUM_LOCAL + PRINTER_ENUM_CONNECTIONS enumerates printers that are installed on the local machine. These printers include those that are physically attached to the local machine as well as remote printers to which it has a network connection.
- nFlags (optional, additive)
default = PRINTER_ENUM_LOCAL
One or a combination of the following values. Flag Description PRINTER_ENUM_LOCAL The function ignores the cName parameter, and enumerates the locally installed printers.
Windows 95/98/Me: The function will also enumerate network printers because they are handled by the local print provider.PRINTER_ENUM_NAME The function enumerates the printer identified by cName. This can be a server, a domain, or a print provider. If cName is empty, the function enumerates available print providers. PRINTER_ENUM_SHARED The function enumerates printers that have the shared attribute.
Cannot be used in isolation; use an + operation to combine with another PRINTER_ENUM type.PRINTER_ENUM_DEFAULT Windows 95/98/Me: The function returns information about the default printer. PRINTER_ENUM_CONNECTIONS Windows NT/2000/XP: The function enumerates the list of printers to which the user has made previous connections. PRINTER_ENUM_NETWORK Windows NT/2000/XP: The function enumerates network printers in the computer's domain. This value is valid only if nLevel is 1. PRINTER_ENUM_REMOTE Windows NT/2000/XP: The function enumerates network printers and print servers in the computer's domain. This value is valid only if nLevel is 1.
- nLevel (optional)
default = 2
Specifies the level of intormation returned by the function,
Valid values are 1, 2, 4, and 5, which correspond to the PRINTER_INFO_1, PRINTER_INFO_2, PRINTER_INFO_4, and PRINTER_INFO_5 data structures.
Windows 95/98/Me: The value can be 1, 2, or 5.
Windows NT/2000/XP: This value can be 1, 2, 4, or 5.
- nOutputType (optional)
default = APRINT_OUTPUT_ARRAY
Valid values.
APRINT_OUTPUT_ARRAY - the information is returned in a multidimenional array
APRINT_OUTPUT_OBJECTARRAY - the information is returned in a single dimension array, where each row holds an object with custom set properties
Return Value
The number of printers.
See Also
Reference
APaperSizes
APrinterForms
APrinterTrays
APrintJobs