1

I want to know if it is possible to change the “Owner” name that is visible when you bring up the print queue to view the queued printer documents. I have a Windows Service that receives a document from a user and sends it a Windows printer, and the Owner is always the name of the user that logged into the workstation where the Service is running. I would like to change the “Owner” to something else, and this would be done in a C++ Windows DLL that the Windows Service loads and uses.

Added 8/30/16@9:14am ET

Thanks for the suggestion, Thomas. I should have mentioned my research, but it was long and empty. MSDN has a SetJob function which can take 1 of 4 structures (pJob = JOB_INFO_1…JOB_INFO_4). JOB_INFO_1, 2, and 4 have an LPSTR pUserName that appears to be what can be used to change the owner of the print job (Owner?). However, in the remarks section of SetJob it says: “The following members of a JOB_INFO_1, JOB_INFO_2, or JOB_INFO_4 structure are ignored on a call to SetJob: JobId, pPrinterName, pMachineName, pUserName, pDrivername, Size, Submitted, Time, and TotalPages.”

And JOB_INFO_3 does not have this field in it. Nice.

I did not see any other functions that could maybe do this. Can you point me to something specific that I can research more? Or that is known to work? Thanks.

Krasher19
  • 11
  • 3

1 Answers1

2

I'm not sure why MSDN says those fields are ignored. I change pUserName, pDocument, pStatus using SetJob with JOB_INFO_1 and it works perfectly. Just be sure to set Position to JOB_POSITION_UNSPECIFIED.

Vaxdi
  • 21
  • 3