64,654
社区成员
发帖
与我相关
我的任务
分享
GetJob
The GetJob function retrieves information about a specified print job.
BOOL GetJob(
HANDLE hPrinter, // handle to printer
DWORD JobId, // job identifier
DWORD Level, // information level
LPBYTE pJob, // array of jobs
DWORD cbBuf, // bytes in array
LPDWORD pcbNeeded // bytes received or required
);
Level
[in] Specifies the type of information returned in the pJob buffer. If Level is 1, pJob receives a JOB_INFO_1 structure. If Level is 2, pJob receives a JOB_INFO_2 structure.
pJob
[out] Pointer to a buffer that receives a JOB_INFO_1 or a JOB_INFO_2 structure containing information about the job. The buffer must be large enough to store the strings pointed to by the structure members.
To determine the required buffer size, call GetJob with cbBuf set to zero. GetJob fails, GetLastError returns ERROR_INSUFFICIENT_BUFFER, and the pcbNeeded parameter returns the size, in bytes, of the buffer required to hold the array of structures and their data.
JOB_INFO_1
The JOB_INFO_1 structure specifies print-job information such as the job-identifier value, the name of the printer for which the job is spooled, the name of the machine that created the print job, the name of the user that owns the print job, and so on.
typedef struct _JOB_INFO_1 {
DWORD JobId;
LPTSTR pPrinterName;
LPTSTR pMachineName;
LPTSTR pUserName;
LPTSTR pDocument;
LPTSTR pDatatype;
LPTSTR pStatus;
DWORD Status;
DWORD Priority;
DWORD Position;
DWORD TotalPages;
DWORD PagesPrinted;
SYSTEMTIME Submitted;
} JOB_INFO_1, *PJOB_INFO_1;
Members
JobId
Specifies a job identifier.
pPrinterName
Pointer to a null-terminated string that specifies the name of the printer for which the job is spooled.
pMachineName
Pointer to a null-terminated string that specifies the name of the machine that created the print job.
pUserName
Pointer to a null-terminated string that specifies the name of the user that owns the print job.
pDocument
Pointer to a null-terminated string that specifies the name of the print job (for example, "MS-WORD: Review.doc").
pDatatype
Pointer to a null-terminated string that specifies the type of data used to record the print job.
pStatus
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.
Status
Specifies 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_COMPLETE Windows XP and later: Job is sent to the printer, but the job may not be printed yet. See Remarks for more information.
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_RETAINED Windows Vista and later: Job has been retained in the print queue and cannot be deleted. This can be caused by the following:
1) The job was manually retained by a call to SetJob and the spooler is waiting for the job to be released.
2) The job has not finished printing and must finish printing before it can be automatically deleted.
See SetJob for more information about print job commands.
JOB_STATUS_SPOOLING Job is spooling.
JOB_STATUS_USER_INTERVENTION Printer has an error that requires the user to do something.
Priority
Specifies 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
Specifies the job's position in the print queue.
TotalPages
Specifies how many pages the document contains. This value may be zero if the print job does not contain page delimiting information.
PagesPrinted
Specifies the number of pages that have printed. This value may be zero if the print job does not contain page delimiting information.
Submitted
A SYSTEMTIME structure that specifies the time that this document was spooled.
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.
剩下的去问MSDN和度娘吧……