Prev Next
The AddJob function obtains a path string that specifies a file that
you can use to store a spooled print job.
BOOL AddJob(
HANDLE hPrinter,
|
// specifies printer for the print job
|
DWORD Level,
|
// specifies version of print job information data structure
|
LPBYTE pData,
|
// pointer to buffer to receive print job information data
|
DWORD cbBuf,
|
// specifies size of buffer pointed to by pData
|
LPDWORD pcbNeeded
|
// pointer to variable to receive size of print job information data
|
);
|
|
Parameters
-
hPrinter
-
Handle that specifies the printer for the print job. This must be a local
printer that is configured as a spooled printer. If hPrinter is a
handle to a remote printer connection, or if the printer is configured for
direct printing, the AddJob function fails.
-
Level
-
Specifies the version of the print job information data structure that the
function stores into the buffer pointed to by pData. Set this parameter
to one.
-
pData
-
Pointer to a buffer to receive an ADDJOB_INFO_1
data structure and a path string.
-
cbBuf
-
Specifies the size, in bytes, of the buffer pointed to by pData. The
buffer needs to be large enough to contain an ADDJOB_INFO_1 structure
and a path string.
-
pcbNeeded
-
Pointer to a variable to receive the total size, in bytes, of the ADDJOB_INFO_1
data structure plus the path string. If this value is less than or equal to cbBuf
and the function succeeds, this is the actual number of bytes written to the
buffer pointed to by pData. If this number is greater than cbBuf,
the buffer is too small, and you must call the function again with a buffer
size at least as large as *pcbNeeded.
Return Values
If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error
information, call GetLastError.
Remarks
You can call the CreateFile function to open the spool file specified
by the Path member of the ADDJOB_INFO_1 structure, and then call
the WriteFile function to write print job data to it. Once that is
done, call ScheduleJob to notify the print spooler that the print job
can now be scheduled by the spooler for printing.
See Also
ADDJOB_INFO_1, CreateFile,
OpenPrinter, ScheduleJob,
WriteFile
See also:
See:
Questions: