大网数据广告活动
打印与设备

CommitSpoolData function (Winspool.h)

· 52CE 我爱测

The CommitSpoolData function notifies the print spooler that a specified amount of data has been written to a specified spool file and is ready to be rendered.

The CommitSpoolData function notifies the print spooler that a specified amount of data has been written to a specified spool file and is ready to be rendered.

Syntax

HANDLE CommitSpoolData(
  _In_ HANDLE hPrinter,
  _In_ HANDLE hSpoolFile,
       DWORD  cbCommit
);

Parameters

hPrinter [in]

A handle to the printer to which the job was submitted. This should be the same handle that was used to obtain hSpoolFile with GetSpoolFileHandle.

hSpoolFile [in]

A handle to the spool file being changed. On the first call of CommitSpoolData, this should be the same handle that was returned by GetSpoolFileHandle. Subsequent calls to CommitSpoolData should pass the handle returned by the preceding call. See Remarks.

cbCommit

The number of bytes committed to the print spooler.

Return value

If the function succeeds, it returns a handle to the spool file.

If the function fails, it returns INVALID_HANDLE_VALUE.

Remarks

Applications submitting a spooler print job can call GetSpoolFileHandle and then directly write data to the spool file handle by calling WriteFile. To notify the print spooler that the file contains data which is ready to be rendered, the application must call CommitSpoolData and provide the number of available bytes.

If CommitSpoolData is called multiple times, each call must use the spool file handle returned by the previous call. When no more data will be written to the spool file, CloseSpoolFileHandle should be called for the file handle returned by the last call to CommitSpoolData.

Before calling CommitSpoolData, applications must set the file pointer to the position it had before it wrote data to the file. In the process of rendering the data in the spooler file, the print spooler will move the spool file pointer cbCommit bytes from the current value of file pointer.

Requirements

Requirement Value
Minimum supported client Windows Vista [desktop apps only]
Minimum supported server Windows Server 2008 [desktop apps only]
Header Winspool.h (include Windows.h)
Library Winspool.lib
DLL WinSpool.drv

See also

Printing

Print Spooler API Functions

GetSpoolFileHandle

CloseSpoolFileHandle

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。