Warning
从 Windows 10 开始,支持第三方打印提供程序的 API 已弃用。 Microsoft不建议对第三方打印提供商进行任何投资。 此外,在提供 v4 打印驱动程序模型的 Windows 8 和较新版本产品上,第三方打印提供程序可能不会创建或管理使用 v4 打印驱动程序的队列。
本主题列出打印提供程序可以提供的所有功能。 Microsoft Windows SDK 文档中介绍了其中大多数函数。 如果在 Windows 驱动程序工具包(WDK)中描述了该函数,该函数名称将提供关联引用页的链接。
所有打印提供程序都必须为所有列出的函数提供指针。 但是,大多数供应商提供的打印提供程序都是“部分提供程序”,不需要支持函数定义的许多作。 Therefore, many of the function pointers can be NULL. 有关部分打印提供程序的详细信息,请参阅 编写网络打印提供程序。
在以下函数列表中,必须支持的函数标记为“必需”。
All print providers must export the initialization function, InitializePrintProvidor. Pointers to all the other functions must be supplied in a PRINTPROVIDOR structure. (请注意,这两个名称拼写错误,但与头文件 Winsplp.h 中显示的名称一致。
函数分为组,并显示在以下部分中:
Initialization function
打印队列管理功能
打印机驱动程序管理功能
打印作业创建函数
打印作业计划函数
表单管理功能
打印处理器管理功能
打印监视器管理功能
端口管理功能
注册表管理功能
Other functions
Initialization function
| Function | Description |
|---|---|
| InitializePrintProvidor (Required) | 初始化打印提供程序并返回指向提供的函数的指针。 |
打印队列管理功能
| Function | Description |
|---|---|
| AddPrinter | 将打印队列添加到打印提供程序管理的打印队列列表中,并将打印处理器与打印队列相关联。 |
| AddPrinterConnection | 创建与指定打印队列的连接。 |
| ClosePrinter (Required) | 禁用对指定打印队列的调用方访问。 |
| DeletePrinter | 从打印提供程序管理的打印队列列表中删除打印队列。 |
| DeletePrinterConnection | 删除与指定打印队列的连接。 |
| EnumPrinters (Required) | 枚举打印提供程序当前管理的打印队列列表。 |
| FindClosePrinterChangeNotification | Disables printer change notifications that were enabled by FindFirstPrinterChangeNotification. |
| FindFirstPrinterChangeNotification | 返回调用方可用于等待指定打印机事件的等待对象的句柄。 |
| GetPrinter (Required) | 返回指定打印队列的当前参数值。 |
| OpenPrinter (Required) | 允许调用方访问指定的打印队列。 |
| RefreshPrinterChangeNotification | Called by router if client calls FindNextPrinterChangeNotification with the PRINTER_NOTIFY_OPTIONS_REFRESH flag set. |
| ResetPrinter | Modifies a print queue's data type or DEVMODEW structure. |
| SetPrinter (Required) | 设置指定打印队列的参数。 |
| WaitForPrinterChange | Obsolete. |
打印机驱动程序管理功能
| Function | Description |
|---|---|
| AddPrinterDriver | 将指定的打印机驱动程序文件添加到指定的服务器。 |
| AddPrinterDriverEx | Same as AddPrinterDriver, with additional parameters. |
| DeletePrinterDriver | 删除对指定服务器上的指定打印机驱动程序文件的访问权限。 |
| DeletePrinterDriverEx | Same as DeletePrinterDriver, with additional parameters. |
| EnumPrinterDrivers | Returns a list of printer drivers that have been added to a specified server by calling AddPrinterDriver or AddPrinterDriverEx. |
| GetPrinterDriver | Returns information about a printer driver, which the caller can then pass to AddPrinterDriver. (返回的信息通常是从 INF 文件获取的。 |
| [GetPrinterDriverEx | Same as GetPrinterDriver, with additional parameters. |
| GetPrinterDriverDirectory | 返回服务器的打印机驱动程序目录的名称。 |
打印作业创建函数
| Function | Description |
|---|---|
| AbortPrinter (Required) | 尝试从指定的打印队列中删除当前作业。 |
| AddJob (Required) | 返回作业标识符和后台处理程序文件路径。 The caller uses CreateFile and WriteFile to send data to the spool file. |
| EndDocPrinter (Required) | 执行作业完成作。 |
| EndPagePrinter | 执行页面完成作。 |
| ReadPrinter | 从双向打印机获取状态信息。 |
| ScheduleJob (Required) | 通知提供程序可以计划指定的作业。 The job is specified by a job identifier previously returned by AddJob. |
| StartDocPrinter (Required) | 准备打印提供程序以开始打印作业。 |
| StartPagePrinter | 准备打印提供程序以接收打印作业页。 |
| WritePrinter (Required) | 接收打印作业数据流的一部分。 |
Note
The AddJob...ScheduleJob sequence is an alternative to the StartDocPrinter...EndDocPrinter sequence.
打印作业计划函数
| Function | Description |
|---|---|
| EnumJobs (Required) | 返回计划打印作业的列表。 |
| GetJob (Required) | 返回作业参数。 |
| SetJob (Required) | 取消、暂停、恢复或重启打印作业,或设置作业参数。 |
表单管理功能
| Function | Description |
|---|---|
| AddForm | 将指定的窗体添加到可用于指定打印机的表单列表中。 |
| DeleteForm | 从可用于指定打印机的表单列表中删除指定的窗体。 |
| EnumForms | 返回可用于指定打印机的表单列表。 |
| GetForm | 返回指定窗体的特征。 |
| SetForm | 修改指定窗体的特征。 |
打印处理器管理功能
| Function | Description |
|---|---|
| AddPrintProcessor | 在指定的服务器上安装打印处理器,并将其添加到打印提供程序可以调用的打印处理器列表中。 |
| DeletePrintProcessor | 从打印提供程序可以调用的打印处理器列表中删除打印处理器。 |
| EnumPrintProcessorDataTypes | 返回打印提供程序可调用的打印处理器支持的数据类型的列表。 |
| EnumPrintProcessors | 返回打印提供程序可以调用的打印处理器列表。 |
| GetPrintProcessorDirectory | 返回必须存储打印处理器文件的目录路径。 |
打印监视器管理功能
| Function | Description |
|---|---|
| AddMonitor | 将打印监视器添加到打印提供程序可以调用的那些监视器列表中。 |
| DeleteMonitor | 从打印提供程序可以调用的打印监视器列表中删除打印监视器。 |
| EnumMonitors | 返回打印提供程序可以调用的打印监视器的列表。 |
端口管理功能
| Function | Description |
|---|---|
| AddPort | Adds a printer port to the list of those available, typically by calling the specified port monitor's AddPortUI function. |
| AddPortEx(/previous-versions/ff545025(v%3dvs.85)) | Same as AddPort, with additional parameters. |
| ConfigurePort (Required) | Configures a printer port, typically by calling the specified port monitor's ConfigurePortUI function. |
| DeletePort (Required) | Deletes a printer port from the list of those available, typically by calling the specified port monitor's DeletePortUI function. |
| EnumPorts (Required) | 返回可用打印机端口的列表。 |
| SetPort | 设置指定打印机端口的参数。 |
注册表管理功能
| Function | Description |
|---|---|
| DeletePrinterData | Deletes the value currently assigned to a specified value name, under the specified printer's PrinterDriverData key. |
| DeletePrinterDataEx | Same as DeletePrinterData, with additional parameters. |
| DeletePrinterKey | Deletes a specified key and its subkeys, if they are currently stored in the registry under the specified printer's PrinterDriverData key. |
| EnumPrinterData | Returns each of the value names and currently assigned values that are stored in the registry under the specified printer's PrinterDriverData key. |
| EnumPrinterDataEx | Same as EnumPrinterData, with additional parameters. |
| EnumPrinterKey | 返回注册表中当前包含在指定键名称下的子项的列表。 |
| GetPrinterData | Returns the value currently assigned to a specified value name, which is stored in the registry under the specified printer's PrinterDriverData key. |
| GetPrinterDataEx | Same as GetPrinterData, with additional parameters. |
| SetPrinterData | Stores a specified value name and value in the registry, under the specified printer's PrinterDriverData key. |
| SetPrinterDataEx | Same as SetPrinterData, with additional parameters. |
Other functions
| Function | Description |
|---|---|
| XcvData | 提供端口监视器 UI DLL 与端口监视器服务器 DLL 之间的通信路径。 |