What I was trying to accomplish with the lock was to get all of the "associated" print jobs in the queue at the same time (with no unrelated jobs in between them). This may not be possible depending on how your network printer handles the job queue but it works here. (By the way, you are never acquiring the lock you are creating, and you are never discarding it. You need to call CmtGetLock instead of CmtNewLock; you should call CmtNewLock somewhere else and CmtDiscardLock at the end of the program. You can look at the usage in my example if you want.)
This may not be perfect, but its the best solution that I can think of. I'd be interested to see if you modify my example to print a report generated by your applica
tion if it works or if you have issues.
Regards,
-alex