Compartir a través de


GETPRINTER( ) Function

Displays the Printer dialog box and returns the name of the selected printer.

GETPRINTER( )

Return Value

Character. GETPRINTER( ) returns the name of the selected printer. If you exit the Printer dialog box by pressing ESC or by clicking Cancel or Close, GETPRINTER( ) returns an empty string.

Remarks

The contents of the Printer dialog box can differ between versions of Windows. For example, the Printer dialog box might contain only the printer name or include a network path.

Example

The following example clears the main Visual FoxPro window using the CLEAR command. The variable cPrinter stores the return value of GETPRINTER( ), which displays the Printer dialog box, and the WAIT WINDOW command displays the name of the selected printer or "No printer chosen" if no printer was chosen.

CLEAR
cPrinter = GETPRINTER( ) 
WAIT WINDOW IIF(EMPTY(cPrinter), 'No printer chosen', cPrinter)

See Also

Reference

APRINTERS( ) Function

SET PRINTER Command

SYS(102) - Printer Setting

SYS(1037) - Page Setup Dialog Box

Other Resources

Functions

Language Reference (Visual FoxPro)