3

I've tried searching for this for a while now, but I can't find any MS documentation which details what the maximum and minimum valid print job IDs are for windows.

Does anyone know of documentation anywhere that might provide this information?

The reason why I'm asking is because I need to know if 0 is a valid print job ID. I'm assuming not, but I don't really have much to base that on!

Dave
  • 25,297
  • 10
  • 57
  • 69
Andy
  • 151
  • 1
  • 11
  • Are you programming? If so, add something to the queue, then retrieve the ID – Dave Oct 01 '12 at 08:24
  • Well, reason I'm asking is because I have a situation where I'm getting an unexpected event in my printer driver, giving me a job ID of 0. I then get the true job ID in the next event. So I'm just wondering if I can rely on 0 being an invalid job ID and throw the event away based on job ( (ID == 0) => invalid event). I think I'd need more confidence than making an assumption on a few valid IDs returned from a few prints. :) – Andy Oct 01 '12 at 08:28
  • No you can't rely on it - the ID has nothing to do with the state. This may help: http://support.microsoft.com/kb/202480 ~(It's a how to Determine Printer Status and Print Job Status from Visual Basic) – Dave Oct 01 '12 at 08:34
  • But how can you get the status of a print job that doesn't exist? ;) I guess I could try and get the print job, and if it doesn't exist, I know it's an invalid Job ID. I guess I was just wondering if there's documentation that would mean I can rely on a Job ID of 0 indicating an invalid event. – Andy Oct 01 '12 at 08:53
  • But a Job ID of 0 doesn't meant it doesn't exist - it means it is live and happy (or unhappy)! – Dave Oct 01 '12 at 09:04
  • I think I've found something that kinda backs that up: http://msdn.microsoft.com/en-us/library/windows/desktop/dd374577(v=vs.85).aspx. It says under Job ID that 0 indicates a print job that hasn't been assigned an ID as yet. So it does exists, but it hasn't been assigned an ID (An ID being 1 or over). – Andy Oct 01 '12 at 10:46
  • I think this going to be specific for each printer type. So an ID of 0 means the queue is empty (or that no jobs have been assigned). I doubt you can throw the event away as it appears to be a valid state. – Dave Oct 01 '12 at 11:05
  • Well, it seems to be a valid ID (although you can't get a JOB_INFO_* structure from it), but throwing the event away is also valid. As a driver developer, I don't have to handle any of these events at all, so not handling this particular one isn't a bad thing. Failing the event (as I was doing) would be a bad thing! :) – Andy Oct 01 '12 at 11:41
  • Sure! Sounds good to me! :) – Andy Oct 01 '12 at 12:17

2 Answers2

0

According to the documentation for the Win32_PrintJob class, the JobId property is a uint32, so its value may range from 0 to 4,294,967,295 (232-1). Additional restrictions may apply, though.

Ansgar Wiechers
  • 5,400
  • 2
  • 21
  • 23
  • That's the representable range, not all of which are necessarily valid. As a comment states, you can get jobID = 0 for an invalid job. – MSalters Oct 01 '12 at 09:51
0

Answered in the comments by OP

It (see source below) says under Job ID that 0 indicates a print job that hasn't been assigned an ID as yet. So it does exists, but it hasn't been assigned an ID (An ID being 1 or over).

Source

Andy
  • 151
  • 1
  • 11
Dave
  • 25,297
  • 10
  • 57
  • 69