Click here to Skip to main content
15,886,565 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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[^]);

C++
if (::EnumJobs(hPrinter_, 0, 1, 2, pBuffer, bufferSize, &sizeNeeded, &numJobs) == 0)
				{
					//DEVMODE opDevMode, ipDevMode = {0};
					//DWORD dwNeed = -1;
					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?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900