当前位置:项目开发->项目经验->打印机操作API大全,有了这些打印机全搞定

原创版权标志打印机操作API大全,有了这些打印机全搞定

作者:codexia  发表时间:2016/12/12 22:01:44  阅读:
[摘要] 搞定这么多API函数,打印机程序也就玩得很溜了。但不是所有的你都用得上,也没有必要记忆,收藏本文,需要的时候,再查就行了。
文章来源:C++技术网原创文章版权所有,会员文章禁止转载。非会员文章转载做好本文超链接即表示授权转载。通过文章下面的分享按钮可以自由分享所有文章。

        下面列出所有的打印机操作函数,分为基本的打印函数和更多的操作函数。为了保证函数意义快速得知和准确,我前面给出了中文翻译,后面紧跟着MSDN的原本。在阅读时可以对照着看。

        搞定这么多API函数,打印机程序也就玩得很溜了。但不是所有的你都用得上,也没有必要记忆,收藏本文,需要的时候,再查就行了。

    打印机操作API大全,有了这些打印机全搞定

    打印相关基本函数

AbortDoc:(中途停止文档打印)Stops the current print job and erases everything drawn since the last call to the StartDoc function.
DeviceCapabilities:(查询打印设备的能力) Retrieves the capabilities of a printer device driver.
EndDoc:(正常结束文档打印)Ends a print job.
EndPage:(结束打印当页)Notifies the device that the application has finished writing to a page.
Escape:(设备控制函数)Enables applications to access capabilities of a particular device that are not available through GDI.
ExtEscape:(扩展版设备控制函数) Enables applications to access capabilities of a particular device that are not available through GDI.
SetAbortProc:(为Windows指定取消打印时执行的回调函数的地址)Sets the application-defined abort function that allows a print job to be canceled during spooling.
StartDoc:(开始打印文档) Starts a print job.
StartPage:(开始打印一页) Prepares the printer driver to accept data.

打印机、打印队列的各种信息和配置函数
AbortPrinter:(清空打印队列,删除与一台打印机关联在一起的缓冲文件)Deletes a printer's spool file if the printer is configured for spooling.
AbortProc:(程序默认的取消打印函数) An application-defined callback function used with the SetAbortProc function.
AddForm:(为打印机的表单列表添加一个新表单) Adds a form to the list of available forms that can be selected for the specified printer.
AddJob:(用于获取一个有效的路径名,以便用它为作业创建一个后台打印文件。它也会为作业分配一个作业编号) Adds a print job to the list of print jobs that can be scheduled by the print spooler.
AddMonitor:(为系统添加一个打印机监视器) Installs a local port monitor and links the configuration, data, and monitor files.
AddPort:(启动“添加端口”对话框) Adds the name of a port to the list of supported ports.
AddPrinter:(在系统中添加一台新打印机) Adds a printer to the list of supported printers for a specified server.
AddPrinterConnection:(连接指定的打印机) Adds a connection to the specified printer for the current user.
AddPrinterDriver:(为指定的系统添加一个打印驱动程序) Installs a local or remote printer driver and links the configuration, data, and driver files.
AddPrinterDriverEx:(AddPrinterDriver扩展版) Installs a local or remote printer driver and links the configuration, data, and driver files.
AddPrintProcessor:(为指定的系统添加一个打印处理器) Installs a print processor on the specified server and adds the print-processor name to an internal list of supported print processors.
AddPrintProvidor:(为系统添加一个打印供给商) Installs a local print provider and links the configuration, data, and provider files.
AdvancedDocumentProperties:(启动打印机文档设置对话框) Displays a printer-configuration dialog box for the specified printer, allowing the user to configure that printer.
ClosePrinter:(关闭一个打开的打印机对象) Closes the specified printer object.
ConfigurePort:(针对指定的端口,启动一个端口配置对话框) Displays the port-configuration dialog box for a port on the specified server.
ConnectToPrinterDlg:(启动连接打印机对话框,用它同访问网络的打印机连接) Displays a dialog box that lets users browse and connect to printers on a network.
DeleteForm:(从打印机可用表单列表中删除一个表单) Removes a form name from the list of supported forms.
DeleteMonitor:(删除指定的打印监视器) Removes a port monitor added by the AddMonitor function.
DeletePort:(启动“删除端口”对话框,答应用户从当前系统删除一个端口) Displays a dialog box that allows the user to delete a port name.
DeletePrinter:(将指定的打印机标志为从系统中删除) Deletes the specified printer object.
DeletePrinterConnection:(删除与指定打印机的连接) Deletes a connection to a printer.
DeletePrinterData:(删除打印机的指定配置数据) Deletes specified configuration data for a printer.
DeletePrinterDataEx:(DeletePrinterData扩展版) Deletes a specified value from the configuration data for a printer.
DeletePrinterDriver:(从系统删除一个打印机驱动程序) Removes the specified printer-driver name from the list of names of supported drivers for a server.
DeletePrinterDriverEx:(DeletePrinterDriver扩展版) Removes the specified printer-driver name from the list of names of supported drivers for a server and deletes the files associated with the driver.
DeletePrinterKey:(删除打印机指定的键和这个键的所有子键) Deletes a specified key and all its subkeys for a specified printer.
DeletePrintProcessor:(从指定系统删除一个打印处理器) Removes a printer processor.
DeletePrintProvidor:(从系统中删除一个打印供给商) Removes a local print provider.
DocumentProperties:(查询或修改指定打印机初始化信息或者显示打印机配置属性表单,也就是打印机属性对话框) Retrieves or modifies printer initialization information or displays a printer-configuration property sheet for the specified printer.
EndDocPrinter:(在后台打印程序的级别指定一个文档的结束) Ends a print job for the specified printer.
EndPagePrinter:(指定一个页在打印作业中的结尾) Notifies the print spooler that the application is at the end of a page in a print job.
EnumForms:(枚举一台打印机可用的表单) Enumerates the forms supported by the specified printer.
EnumJobs:(枚举打印队列中的作业) Retrieves information about a specified set of print jobs for a specified printer.
EnumMonitors:(枚举可用的打印监视器) Retrieves information about the port monitors installed on the specified server.
EnumPorts:(枚举一个系统可用的端口) Enumerates the ports that are available for printing on a specified server.
EnumPrinterData:(枚举打印机配置数据) Enumerates configuration data for a specified printer.
EnumPrinterDataEx:(EnumPrinterData扩展版) Enumerates all value names and data for a specified printer and key.
EnumPrinterDrivers:(枚举指定系统中已安装的打印机驱动程序) Enumerates the printer drivers installed on a specified printer server.
EnumPrinterKey:(枚举打印机指定键的所有子键) Enumerates the subkeys of a specified key for a specified printer.
EnumPrinters:(枚举系统中安装的打印机) Enumerates available printers, print servers, domains, or print providers.
EnumPrintProcessorDatatypes:(枚举由一个打印处理器支持的数据类型) Enumerates the data types that a specified print processor supports.
EnumPrintProcessors:(枚举系统中可用的打印处理器) Enumerates the print processors installed on the specified server.
FindClosePrinterChangeNotification:(关闭用FindFirstPrinterChangeNotification函数获取的一个打印机通告对象) Closes a change notification object.
FindFirstPrinterChangeNotification:(创建一个新的改变通告对象,以便我们注重打印机状态的各种变化) Creates a change notification object.
FindNextPrinterChangeNotification:(用这个函数判定触发一次打印机改变通告信号的原因) Retrieves information about the most recent change notification for a change notification object.
FlushPrinter:(刷新打印机缓存) Sends a buffer to the printer in order to clear it from a transient state.
FreePrinterNotifyInfo:(释放由FindNextPrinterChangeNotification函数分配的一个缓冲区) Frees a system-allocated buffer created by the FindNextPrinterChangeNotification function.
GetDefaultPrinter:(获取默认的打印机名称) Retrieves the printer name of the default printer for the current user on the local computer.
GetForm:(取得与指定表单有关的信息) Retrieves information about a specified form.
GetJob:(获取与指定作业有关的信息) Retrieves information about a specified print job.
GetPrinter:(取得与指定打印机有关的信息) Retrieves information about a specified printer.
GetPrinterData:(为打印机设置注册表配置信息) Retrieves configuration data for the specified printer or print server.
GetPrinterDataEx:(GetPrinterData扩展版) Retrieves configuration data for the specified printer or print server.
GetPrinterDriver:(针对指定的打印机,获取与打印机驱动程序有关的信息) Retrieves driver data for the specified printer.
GetPrinterDriverDirectory:(判定指定系统中包含了打印机驱动程序的目录是什么) Retrieves the path of the printer-driver directory.
GetPrintProcessorDirectory:(判定指定系统中包含了打印机处理器驱动程序及文件的目录) Retrieves the path for the print processor on the specified server.
OpenPrinter:(打开指定的打印机,并获取打印机的句柄) Retrieves a handle to the specified printer or print server.
PrinterProperties:(启动打印机属性对话框,以便对打印机进行配置) Displays a printer-properties property sheet for the specified printer.
PrintWindow:(打印当前窗口可视部分,也就是当前窗口显示的东西打印出来) Copies a visual window to a device context.
ReadPrinter:(从打印机读入数据) Retrieves data from the specified printer.
ResetPrinter:(改变指定打印机的默认数据类型及文档设置) Specifies the data type and device mode values to be used for printing documents submitted by the StartDocPrinter function.
ScheduleJob:(提交一个要打印的作业) Requests that the print spooler schedule a specified print job for printing.
SetDefaultPrinter:(设置默认的打印机) Sets the printer name of the default printer for the current user on the local computer.
SetForm:(为指定的表单设置信息) Sets the form information for the specified printer.
SetJob:(对一个打印作业的状态进行控制) Pauses, resumes, cancels, or restarts a print job on a specified printer.
SetPort:(设置与打印机关联的端口的状态) Sets the status associated with a printer port.
SetPrinter:(对一台打印机的状态进行控制) Sets the data for a specified printer or sets the state of the specified printer by pausing printing, resuming printing, or clearing all print jobs.
SetPrinterData:(设置打印机的注册表配置信息) Sets the configuration data for a printer or print server.
SetPrinterDataEx:(SetPrinterData的扩展版) Sets the configuration data for a printer or print server.
StartDocPrinter:(在后台打印的级别启动一个新文档) Notifies the print spooler that a document is to be spooled for printing.
StartPagePrinter:(在打印作业中指定一个新页的开始) Notifies the spooler that a page is about to be printed on the specified printer.
WritePrinter:(将发送目录中的数据写入打印机) Notifies the print spooler that data should be written to the specified printer.
文章来源:C++技术网原创文章版权所有,会员文章禁止转载。非会员文章转载做好本文超链接即表示授权转载。通过文章下面的分享按钮可以自由分享所有文章。


返回顶部

在线提问
问题标题:
问题描述:(简陋的描述会导致问题被最后回答、没有针对性回答甚至无法解答。请确保问题描述的足够清楚。)

C++技术网群聊

弹聊