RpcSetJob pauses, resumes, cancels, or restarts a print job. It also sets print job parameters, such as the job priority and the document name.

 DWORD RpcSetJob(
   [in] PRINTER_HANDLE hPrinter,
   [in] DWORD JobId,
   [in, unique] JOB_CONTAINER* pJobContainer,
   [in] DWORD Command
 );

hPrinter: A PRINTER_HANDLE (section 2.2.1.1.4) to a printer object, job object, or server object that was opened by RpcAddPrinter (section 3.1.4.2.3), RpcAddPrinterEx (section 3.1.4.2.15), RpcOpenPrinter (section 3.1.4.2.2), or RpcOpenPrinterEx (section 3.1.4.2.14).

JobId: The identifier of the print job. This value MUST NOT be zero.

pJobContainer: An optional pointer to a JOB_CONTAINER (section 2.2.1.2.5) that specifies the parameters to set on the job object.

If the value of the Command parameter is zero, this pointer MUST be specified.

Command: A Job Control Value (section 2.2.4.6) that specifies an action. This value MUST be one of the following job control actions:

Name/value

Description

0x00000000

Perform no additional action.

JOB_CONTROL_PAUSE

0x00000001

Pause the print job.

JOB_CONTROL_RESUME

0x00000002

Resume a paused print job.

JOB_CONTROL_CANCEL

0x00000003

Delete a print job.<321>

JOB_CONTROL_RESTART

0x00000004

Restart a print job.

JOB_CONTROL_DELETE

0x00000005

Delete a print job.<322>

JOB_CONTROL_SENT_TO_PRINTER

0x00000006

Used by port monitors to signal that a print job has been sent to the printer. This value SHOULD NOT be used remotely.

JOB_CONTROL_LAST_PAGE_EJECTED

0x00000007

Used by language monitors to signal that the last page of a print job has been ejected from the printer. This value SHOULD NOT be used remotely.

JOB_CONTROL_RETAIN

0x00000008

Keep the print job in the print queue after it prints.

JOB_CONTROL_RELEASE

0x00000009

Release the print job, undoing the effect of a JOB_CONTROL_RETAIN action.

Return Values: This method MUST return zero (ERROR_SUCCESS) to indicate successful completion or a nonzero Windows error code to indicate failure [MS-ERREF].

Upon receiving this message, the server MUST validate parameters as follows:

If parameter validation fails, the server MUST fail the operation immediately and return to the client ERROR_INVALID_PARAMETER or another nonzero error specified in the preceding JOB_CONTAINER validation steps; otherwise, the server MUST process the message and respond to the client as follows: