EnumJobs

BOOL EnumJobs(
  HANDLE  hPrinter,     /* handle of printer object                   */
  DWORD   dwFirstJob,   /* location of first job in print queue       */
  DWORD   dwNoJobs,     /* number of jobs to enumerate                */
  DWORD   dwLevel,      /* structure level                            */
  LPBYTE  lpbJob,       /* address of structure array                 */
  DWORD   dwBuf,        /* size of array, in bytes                    */
  LPDWORD lpdwNeeded    /* addr. of variable with no. of bytes copied */
                        /* (or required)                              */
  LPDWORD lpdwReturned  /* addr. of variable with no. of job info     */
                        /* structures copied                          */
);
 

Initializes an array of either JOB_INFO_1 or JOB_INFO_2 structures with data describing the specified print jobs for the specified printer.

hPrinter Identifies a printer object.
dwFirstJob Specifies the location of the first enumerated job in the print queue. For example, a value of 10 indicates that enumeration should begin at the tenth job.
dwNoJobs Specifies the total number of print jobs to enumerate.
dwLevel Specifies whether the function should use JOB_INFO_1 or JOB_INFO_2 structures to store data for the enumerated jobs. A value of 1 specifies that the JOB_INFO_1 structure should be used; a value of 2 specifies that the JOB_INFO_2 structure should be used.
lpbJob Points to an array of either JOB_INFO_1 or JOB_INFO_2 structures.
dwBuf Specifies the size, in bytes, of the array pointed to by lpbJob.
lpdwNeeded Points to a value that specifies the number of bytes copied if the function succeeds; otherwise, this value specifies the number of bytes required.
lpdwReturned Points to a value that specifies the number of JOB_INFO_1 or JOB_INFO_2 structures that were initialized.

The handle hPrinter is obtained by calling the OpenPrinter function.

The JOB_INFO_1 structure contains general print-job data; the JOB_INFO_2 structure is much more detailed.