Delete/cancel all print jobs

  • Thread starter Thread starter kerpal
  • Start date Start date
K

kerpal

Hi all,

How can I delete or cancel all the jobs on a printer??
Printer.KillDoc only deletes the current document being printed.
And this may be a dumb question to ask... I suspect that I can somehow use
the EnumJobs to cancel each job one by one but I don't really understand how
to work with printer handle and the printer object?

Thanks in advance for any suggestions or pointers.
 
Hi,

You can use the wmi to do that. I do not have a sample. Here are
some links.


To list printers add a reference to system.management.dll.

Dim moReturn As Management.ManagementObjectCollection

Dim moSearch As Management.ManagementObjectSearcher

Dim mo As Management.ManagementObject

moSearch = New Management.ManagementObjectSearcher("Select * from
Win32_Printer")

moReturn = moSearch.Get

For Each mo In moReturn

Debug.Write(mo("Name").ToString)

Next



Usefull links



http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printer.asp

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_printjob.asp

http://msdn.microsoft.com/library/d...ntManagementObjectClassInvokeMethodTopic2.asp


Ken
 
Back
Top