SetJob

  BOOL SetJob(hPrinter, JobId, Level, pJob, Command)    
  HANDLE hPrinter;    
  DWORD JobId;    
  DWORD Level;    
  LPBYTE pJob;    
  DWORD Command;    

The SetJob function sets information for a print job and gives commands to a print job.

Parameters

hPrinter

Indicates the open Printer handle that this function is to be performed upon. This Handle is obtained with the OpenPrinter function.

JobId

Indicates the identification number of the job for which this operation is to be performed upon

Level

This value can be 0, 1, or 2

pJob

This value can be NULL, or a pointer to a JOB_INFO_1 or JOB_INFO_2 structure.

Command

Specifies an operation to perform on the print job. It is not defined as a bit-mask; it specifies one, and only one, operation.

A value of zero is ignored. It is used when calling this function to set JOB_INFO_1 or JOB_INFO_2 information via the pJob parameter.

The following values have meaning:

Value Meaning

JOB_CONTROL_PAUSE  
  Pause the print job.
JOB_CONTROL_RESUME  
  Resume a paused print job.
JOB_CONTROL_CANCEL  
  Delete the print job.
JOB_CONTROL_RESTART  
  Restart a printing job. A job can only be restarted if it was printing.

Comments

The SetJob function can set various print job parameters via the JOB_INFO_1 or JOB_INFO_2 data structure: the document name, the printer processor to use, the status and priority of a job, the print comment string, the print datatype, etc. See JOB_INFO_1 or JOB_INFO_2 for further information.

To remove or delete all the print jobs for a particular printer, rather than call SetJob for each job, call SetPrinter with the control parameter set to purge.