EnumJobs

  BOOL EnumJobs(hPrinter, FirstJob, NoJobs, Level, pJob, cbBuf, pcbNeeded, pcReturned)    
  HANDLE hPrinter;    
  DWORD FirstJob;    
  DWORD NoJobs;    
  DWORD Level;    
  LPBYTE pJob;    
  DWORD cbBuf;    
  LPDWORD pcbNeeded;    
  LPDWORD pcReturned;    

The EnumJobs function retrieves information about a specified set of print jobs for a specified printer.

Parameters

hPrinter

Indicates the open Printer handle that this function is to be performed upon. This Handle is obtained with the OpenPrinter function.

FirstJob

Specifies the position of the first print job to enumerate. For example, a value of 10 indicates that the enumeration should begin at the printer's tenth print job.

NoJobs

Specifies the number of print jobs to enumerate.

Level

Specifies the type of Data returned. This value can be 1, or 2, meaning JOB_INFO_1, or JOB_INFO_2 accordingly, will be returned in the buffer pointed to by pJob.

pJob

Pointer to a buffer that the function will fill with an array of NoJobs JOB_INFO_1 or JOB_INFO_2 data structures.

cbBuf

The size in bytes of the buffer pointed to by lpJob.

pcbNeeded

This points to a variable that will be updated to contain the actual buffer size required that is pointed to by pJob. If cbBuf is too small then GetLastError will indicate ERROR_BUFFER_TOO_SMALL, and pcbNeeded will contain the size required. If cbBuf is large enough, then pcbNeeded will contain the number of bytes that were copied.

pcReturned

Pointer to a DWORD that the function will set to the number of data structures written to the buffer pointed to by pJob.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. To obtain extended error information, use the GetLastError function.

See Also

GetJob, SetJob, JOB_INFO_1, JOB_INFO_2