JOB_INFO_2 structure

The JOB_INFO_2 structure describes a full set of values associated with a job.

Syntax

typedef struct _JOB_INFO_2 {
  DWORD                JobId;
  LPTSTR               pPrinterName;
  LPTSTR               pMachineName;
  LPTSTR               pUserName;
  LPTSTR               pDocument;
  LPTSTR               pNotifyName;
  LPTSTR               pDatatype;
  LPTSTR               pPrintProcessor;
  LPTSTR               pParameters;
  LPTSTR               pDriverName;
  LPDEVMODE            pDevMode;
  LPTSTR               pStatus;
  PSECURITY_DESCRIPTOR pSecurityDescriptor;
  DWORD                Status;
  DWORD                Priority;
  DWORD                Position;
  DWORD                StartTime;
  DWORD                UntilTime;
  DWORD                TotalPages;
  DWORD                Size;
  SYSTEMTIME           Submitted;
  DWORD                Time;
  DWORD                PagesPrinted;
} JOB_INFO_2, *PJOB_INFO_2;

Members

JobId

A job identifier value.

pPrinterName

A pointer to a null-terminated string that specifies the name of the printer for which the job is spooled.

pMachineName

A pointer to a null-terminated string that specifies the name of the machine that created the print job.

pUserName

A pointer to a null-terminated string that specifies the name of the user who owns the print job.

pDocument

A pointer to a null-terminated string that specifies the name of the print job (for example, "MS-WORD: Review.doc").

pNotifyName

A pointer to a null-terminated string that specifies the name of the user who should be notified when the job has been printed or when an error occurs while printing the job.

pDatatype

A pointer to a null-terminated string that specifies the type of data used to record the print job.

pPrintProcessor

A pointer to a null-terminated string that specifies the name of the print processor that should be used to print the job.

pParameters

A pointer to a null-terminated string that specifies print-processor parameters.

pDriverName

A pointer to a null-terminated string that specifies the name of the printer driver that should be used to process the print job.

pDevMode

A pointer to a DEVMODE structure that contains device-initialization and environment data for the printer driver.

pStatus

A pointer to a null-terminated string that specifies the status of the print job. This member should be checked prior to Status and, if pStatus is NULL, the status is defined by the contents of the Status member.

pSecurityDescriptor

The value of this member is NULL. Retrieval and setting of document security descriptors is not supported in this release.

Status

The job status. This member can be one or more of the following values.

Value Meaning
JOB_STATUS_BLOCKED_DEVQ The driver cannot print the job.
JOB_STATUS_DELETED Job has been deleted.
JOB_STATUS_DELETING Job is being deleted.
JOB_STATUS_ERROR An error is associated with the job.
JOB_STATUS_OFFLINE Printer is offline.
JOB_STATUS_PAPEROUT Printer is out of paper.
JOB_STATUS_PAUSED Job is paused.
JOB_STATUS_PRINTED Job has printed.
JOB_STATUS_PRINTING Job is printing.
JOB_STATUS_RESTART Job has been restarted.
JOB_STATUS_SPOOLING Job is spooling.
JOB_STATUS_USER_INTERVENTION Printer has an error that requires the user to do something.

In Windows XP and later versions of Windows, the following values can also be used:

Value Meaning
JOB_STATUS_COMPLETE The job is sent to the printer, but may not be printed yet. See Remarks for more information.
JOB_STATUS_RETAINED The job has been retained in the print queue following printing.

Priority

The job priority. This member can be one of the following values or in the range between 1 through 99 (MIN_PRIORITY through MAX_PRIORITY).

Value Meaning
MIN_PRIORITY Minimum priority.
MAX_PRIORITY Maximum priority.
DEF_PRIORITY Default priority.

Position

The job's position in the print queue.

StartTime

The earliest time that the job can be printed.

UntilTime

The latest time that the job can be printed.

TotalPages

The number of pages required for the job. This value may be zero if the print job does not contain page delimiting information.

Size

The size, in bytes, of the job.

Submitted

A SYSTEMTIME structure that specifies the time when the job was submitted.

This time value is in Universal Time Coordinate (UTC) format. You should convert it to a local time value before displaying it. You can use the FileTimeToLocalFileTime function to perform the conversion.

Time

The total time, in milliseconds, that has elapsed since the job began printing.

PagesPrinted

The number of pages that have printed. This value may be zero if the print job does not contain page delimiting information.

Remarks

Port monitors that do not support TrueEndOfJob will set the job as JOB_STATUS_PRINTED right after the job is submitted to the printer.

Requirements

Requirement Value
Minimum supported client
Windows 2000 Professional [desktop apps only]
Minimum supported server
Windows 2000 Server [desktop apps only]
Header
Winspool.h (include Windows.h)
Unicode and ANSI names
_JOB_INFO_2W (Unicode) and _JOB_INFO_2A (ANSI)

See also

Printing

Print Spooler API Structures

DEVMODE

EnumJobs

GetJob

SetJob