I am writing a code where I am enumarating all jobs in printer spooler and getting JOB_INFO_4 (
http://msdn.microsoft.com/en-us/library/windows/desktop/dd145022(v=vs.85).aspx[
^]);
if (::EnumJobs(hPrinter_, 0, 1, 2, pBuffer, bufferSize, &sizeNeeded, &numJobs) == 0)
{
DWORD err = GetLastError();
SYSTEMTIME st = {0};
bufferSize = sizeNeeded;
pBuffer = new BYTE[sizeNeeded];
if(::EnumJobs(hPrinter_, 0, 1, 2, pBuffer, bufferSize, &sizeNeeded, &numJobs) != 0)
{
JOB_INFO_4 *pJobInfo = reinterpret_cast<JOB_INFO_4*>(pBuffer);
}
Here " pJobInfo-> Status" is coming 1) zero for a offline printer;
2) 8210 for a printer with some error
3) 4096 for a prionter which is printing;
But according to MSDN, the value shoule be :
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.
Any idea why I am getting zero for offline printer?