This demonstrates how to call the EnumJobs Windows API function.  It also involves the use
of the following API functions:

OpenPrinter
ClosePrinter
RtlMoveMemory
lstrlen
lstrcpy

The RtlMoveMemory function is used to copy the data from a blob used as a buffer to the actual structure.  Since the JOB_INFO_1 structure contains pointers to strings, the lstrlen and lstrcpy functions are used to get the strings those pointers refer to.

Rather than calling EnumJob once for all jobs, the routine loops and calls EnumJob one for each job.  That's because the size of the buffer varies between jobs, and there's no good way in PB to determine the size for each job if all of the jobs are returned in a single call.


bruce.armstrong@teamsybase.com


