Home   Index   About
Ultimate Pack


Custom Search
Overview
Group
Quick Info

Windows NT
Yes
Win95
Yes
Win32s
No
Import Library
winspool.lib
Header File
winspool.h
Unicode
WinNT
Platform Notes
None

SetJob

The SetJob function pauses, resumes, cancels, or restarts a print job on a specified printer. You can also use the SetJob function to set print job parameters, such as the print job priority and the document name.

Windows 95: You can use the SetJob function to give a command to a print job, or to set print job parameters, but you can not do both in the same call. Thus, when the Command parameter is non-zero, the function ignores the Level and pJob parameters. To set print job parameters, you must set Command to 0.

Windows NT: You can use the SetJob function to give a command to a print job, or to set print job parameters, or you can do both in the same call. The value of the Command parameter does not affect how the function uses the Level and pJob parameters.

BOOL SetJob(

HANDLE hPrinter,
// handle to printer object
DWORD JobId,
// print job identifier
DWORD Level,
// specifies type of job information structure
LPBYTE pJob,
// pointer to job information structure
DWORD Command
// job command value
);

Parameters

hPrinter

Handle to the printer object of interest.

JobId

Identifier that specifies the print job. You obtain a print job identifier by calling the AddJob function or the StartDoc function.

Windows NT: If the Level parameter is set to 3, the JobId parameter must match the JobId member of the JOB_INFO_3 structure pointed to by pJob.

Level

Specifies the type of job information structure pointed to by the pJob parameter. You can set the Level parameter to 0, 1, or 2.

When you set Level to 0, pJob should be NULL. Use these values when you are not setting any print job parameters.

Windows NT: You can also set the Level parameter to 3.

Windows 95: The function pays attention to this parameter only if the Command parameter is 0. If Command is non-zero, the function ignores this parameter and the pJob parameter.

pJob

Pointer to a JOB_INFO_1 or JOB_INFO_2 structure. The function uses this structure to set print job parameters.

Windows NT: pJob can also point to a JOB_INFO_3 structure.

If the Level parameter is 0, pJob should be NULL.

If the Level parameter is 1, pJob should point to a JOB_INFO_1 structure. If the Level parameter is 2, pJob should point to a JOB_INFO_2 structure.

Windows NT: If the Level parameter is 3, pJob should point to a JOB_INFO_3 structure. You must have JOB_ACCESS_ADMINISTER access permission for the jobs specified by the JobId and NextJobId members of the JOB_INFO_3 structure.

Windows 95: The function pays attention to this parameter only if the Command parameter is 0. If Command is non-zero, the function ignores this parameter and the Level parameter.

Command

Specifies the print job operation to perform. You can use one of the following values:

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

Windows 95: If you are using the SetJob function to set print job parameters, you must set the Command parameter to 0.

Windows NT: You can use the same call to the SetJob function to set print job parameters and to give a command to a print job. Thus, Command does not need to be 0 if you are setting print job parameters, although it can be.

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 use the SetJob function to set various print job parameters by supplying a pointer to a JOB_INFO_1, JOB_INFO_2, or JOB_INFO_3 structure that contains the necessary data.

Windows 95: When you use the function to set print job parameters, you must set the Command parameter to 0.

To remove or delete all of the print jobs for a particular printer, call the SetPrinter function with its Command parameter set to PRINTER_CONTROL_PURGE.

The following members of a JOB_INFO_1 or JOB_INFO_2 structure are ignored on a call to SetJob:

JobId, pPrinterName, pMachineName, pDrivername, Size, Submitted, and Time.

You must have PRINTER_ACCESS_ADMINISTER access permission for a printer in order to change a print job's position in the print queue.

If you do not want to set a print job's position in the print queue, you should set the Position member of the JOB_INFO_1 or JOB_INFO_2 structure to JOB_POSITION_UNSPECIFIED.

Windows NT: Use the SetJob function with the JOB_INFO_3 structure to link together a set of print jobs. This can be useful in situations where a single document consists of several parts that you want to render separately.

See Also

AddJob
, GetJob, OpenPrinter, SetPrinter, JOB_INFO_1, JOB_INFO_2, JOB_INFO_3


Last news from Greatis Software

Nostalgia .Net     Nostalgia .Net     .Net is powerful, but not all-powerful, so sometimes we need to use Win32 API for our .Net applications. It's simple enough with Platform Invoke if you have Win32 skill, but we do not always have time to dig the ancient documentation, declare the special types that are compatible with Win32, find the values of the Win32's constants and so on. Nostalgia .Net offers several simple-to-use classes, and components that will allow you to forget about the headache of Win32 and just use the power of Win32 in your application the same way as you use the native. Net classes.  More »

Recommended software for developers

Ultimate Pack for Delphi and C++ Builder     Ultimate Pack     Component pack for Delphi and C++ Builder that contains runtime form designer, runtime object inspector, print suite and much more for the very special price.  More »

Form Designer .Net     Form Designer .Net     Unique runtime form design solution that allows to edit any form in .Net WinForms application at runtime with full source codes for only 300 euro!  More »

Print Suite .Net     Print Suite .Net     Print Suite .Net is a set of components for easy printing texts, images and grids from your WinForms applications. Full C# source codes are available  More »

Gradient Controls .Net     Gradient Controls .Net     Gradient Controls .Net offers controls with gradient background feature. Labels, panels and so on... Full C# source codes are available  More »

iGrid     Greatis iGrid     iGrid plots drawing grid right over your desktop, so you can use it everywhere, with any drawing application without any special plugins for different graphic editors.  More »


All the contacts and projects

Dmitry Vasiliev (just.dmitry)

Related Links

Software for Visual Studio .NET developers
Software for Delphi and C++ Builder developers
Software for Visual Basic 6 developers
Delphi Tips&Tricks
MegaDetailed.NET

More Online Helps

Win32 Programmer's Reference
Win32 Multimedia Programmer's Reference
OLE Programmer's Reference
Microsoft Windows Pen API Programmer's Reference
Microsoft Windows Sockets 2 Reference
Microsoft Windows Telephony API (TAPI) Programmer's Reference
Unix Manual Pages

Free Tech Secrets ;) Copyright © 2008-2011 Free Tech Secrets ;) greatis just4fun network just4fun