Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++/CLI Printer MSDN
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)
				{
					//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 30-Apr-13 8:00am
iDebD842

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

  Print Answers RSS
0 OriginalGriff 428
1 Maciej Los 249
2 BillWoodruff 199
3 /\jmot 180
4 Suraj Sahoo | Coding Passion 150
0 OriginalGriff 8,484
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,639
3 Maciej Los 5,159
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 30 Apr 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100