GetDefaultPrinter

渲染和打印

描述

以宽字符串返回系统默认打印机的名称,直接向打印后台处理程序查询。其结果就是普通打印对话框会预选的打印机。

查询失败时(例如未配置默认打印机)以及在非 Windows 平台上,函数返回空字符串,因此调用方可以把空名称视为无默认打印机,而不是错误。

语法

Delphi

Function GetDefaultPrinter: WideString;

返回值

WideString默认打印机的名称
''没有可用的默认打印机、查询失败,或平台不是 Windows

备注

库级别的 GetDefaultPrinterName 方法通过库对象提供同样的查询。

另请参阅

GetDefaultPrinterName, GetPrinterNames, GetLatestPrinterNames, GetPrinterBins