RpcSetPrinter sets the data or state of a specified printer by pausing or resuming printing or by clearing all print jobs.

 DWORD RpcSetPrinter(
   [in] PRINTER_HANDLE hPrinter,
   [in] PRINTER_CONTAINER* pPrinterContainer,
   [in] DEVMODE_CONTAINER* pDevModeContainer,
   [in] SECURITY_CONTAINER* pSecurityContainer,
   [in] DWORD Command
 );

hPrinter: A handle to a printer 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).

pPrinterContainer: A parameter specified in PRINTER_CONTAINER Parameters (section 3.1.4.1.8.6). If the Command is 0, the Level member of the PRINTER_CONTAINER MUST be 0x00000000 or a number from 0x00000002 to 0x00000007. If the Command parameter is 1, 2, or 3, the Level member of the PRINTER_CONTAINER MUST be 0x00000000.

pDevModeContainer: A parameter specified in DEVMODE_CONTAINER Parameters (section 3.1.4.1.8.1).

pSecurityContainer: A parameter specified in SECURITY_CONTAINER Parameters (section 3.1.4.1.8.7).

Command: A value that specifies an action to perform. If this value is non-zero, it is one of the printer control values in the following table, and the Level member of the PRINTER_CONTAINER (section 2.2.1.2.9) structure that is pointed to by the pPrinterContainer parameter MUST be 0x00000000.

Name/value

Description

PRINTER_CONTROL_PAUSE

0x00000001

Pauses the printer object.

PRINTER_CONTROL_RESUME

0x00000002

Resumes a paused printer object.

PRINTER_CONTROL_PURGE

0x00000003

Deletes all print jobs queued for the printer object.

If this value is zero, the PrinterInfo member of the PRINTER_CONTAINER structure that is pointed to by the pPrinterContainer parameter MUST contain a pointer to a PRINTER_INFO (section 2.2.2.9) structure that this method can use. See section 2.2.1.10.1 for details.

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 a nonzero error response to the client. Otherwise, the server MUST process the message and compose a response to the client as follows: