Having issues with setjob api

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here is what I am trying to do. I have written a working program in VB6 that monitors any number of printers simultaneously(sort of). Because VB6 doesn't support multithreading I have to do this with a timers and loops which eats up CPU power and has other inefficiencies. I am slowly converting it over to C# with major revisions. Instead of using a timer or loop I am going to have a different thread for each printer being monitored and using the api functions FindFirstPrinterChangeNotification, FindNextPrinterChangeNotification, WaitForSingleObject, etc... within each thread so that it will use next to nothing in processing power until a print job is added or changed or whatever. My problem right now is that the setjob api function doesn't seem to be functioning(for me anyway). I am trying to use setjob to cancel a job over a certain number of pages. I run the program and the setjob function returns successful but it will not delete the print job. I have tried this function using JOB_CONTROL_CANCEL and JOB_CONTROL_DELETE and neither seem to change the result. I am running WinXP and as I said the VB6 version works ok. I am logged on as a domain admin so permission isn't the issue. If anyone has any suggestions or knows what I need to do to fix this issue please let me know.
 
Brad,

Can you post your declaration of SetJob as well as how you are calling
it? There could be something in your declaration that is off, and affecting
the call.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Brad M. said:
Here is what I am trying to do. I have written a working program in VB6
that monitors any number of printers simultaneously(sort of). Because VB6
doesn't support multithreading I have to do this with a timers and loops
which eats up CPU power and has other inefficiencies. I am slowly
converting it over to C# with major revisions. Instead of using a timer or
loop I am going to have a different thread for each printer being monitored
and using the api functions FindFirstPrinterChangeNotification,
FindNextPrinterChangeNotification, WaitForSingleObject, etc... within each
thread so that it will use next to nothing in processing power until a print
job is added or changed or whatever. My problem right now is that the
setjob api function doesn't seem to be functioning(for me anyway). I am
trying to use setjob to cancel a job over a certain number of pages. I run
the program and the setjob function returns successful but it will not
delete the print job. I have tried this function using JOB_CONTROL_CANCEL
and JOB_CONTROL_DELETE and neither seem to change the result. I am running
WinXP and as I said the VB6 version works ok. I am logged on as a domain
admin so permission isn't the issue. If anyone has any suggestions or knows
what I need to do to fix this issue please let me know.
 
Back
Top