Export (0) Print
Expand All

CommitSpoolData function

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

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.dll

See also

Printing
Print Spooler API Functions
GetSpoolFileHandle
CloseSpoolFileHandle

 

 

Community Additions

ADD
Show:
© 2014 Microsoft