Click or drag to resize

APrinters Function

X#
Stores information about currently-available printers into an array.
The behavior of this function is OS (operating system) - specific. X# may or may not check to see if the printers are actually connected to your computer when it prepares this list, and the list may include all printers installed as printer setups, or only those available on the current network.

Namespace:  XSharp.VFP
Assembly:  XSharp.VFP (in XSharp.VFP.dll) Version: 2.21
Syntax
 FUNCTION APrinters(
	ArrayName,
	nValue
) AS LONG CLIPPER
Request Example View Source

Parameters

ArrayName (Optional)
Type: Usual
Specifies the name of the array containing information about printers.
nValue (Optional)
Type: Usual
Specifies a value that creates a two-column array or five-column array. Each row in the array contains information about a printer.
The table in the remarks section describes the possible values of nValue.

Return Value

Type: Long
Numeric. APRINTERS( ) returns the number of rows in the array or 0 when no printers are available.
Remarks
If the array you include does not exist, X# automatically creates the array. If the array exists but is not large enough to contain all the information, X# increases the size of the array to accommodate the information. If the array is larger than necessary, X# truncates the array. If the array exists but APRINTERS( ) returns 0 because no printers are available, the array remains unchanged. If the array does not exist, and APRINTERS( ) returns 0, the array is not created.

nValueDescription
0 or omitted Return a two-column array containing the following items beginning with the first column:
  • Printer name.
  • Name of the port to which the printer is connected.
1 Return a five-column array containing the following items beginning with the first column:
  • Printer name.
  • Name of the port to which the printer is connected.
  • Name of the printer driver.
  • Printer comment.
  • Printer location.
Examples
X#
1IF APRINTERS(gaPrinters) > 0
2Clear  // clear the current output window
3Display MEMORY LIKE gaPrinters // show the contents of the array
4ELSE
5WAIT 'No printers found.'
6ENDIF
See Also