Displays the Printer dialog box and returns the name of the selected printer.
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.
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.
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)