GetDefaultPrinter

Rendering and printing

Description

Returns the name of the system's default printer as a wide string, queried directly from the spooler. The result is the printer a plain print dialog would preselect.

The function returns an empty string when the query fails, for example when no default printer is configured, and outside Windows, so callers can treat an empty name as no default rather than an error.

Syntax

Delphi

Function GetDefaultPrinter: WideString;

Return values

WideStringThe default printer's name
''No default printer is available, the query failed, or the platform is not Windows

Remarks

The library-level GetDefaultPrinterName method exposes the same query through the library object.

See also

GetDefaultPrinterName, GetPrinterNames, GetLatestPrinterNames, GetPrinterBins