O'Reilly logo

Microsoft® Visual Basic® .NET Programmer's Cookbook by Matthew MacDonald

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Manage Print Jobs

Problem

You want to pause or resume a print job or print queue.

Solution

Use the Pause and Resume methods of the WMI Win32_PrintJob and Win32_Printer classes.

Discussion

WMI isn’t limited to information retrieval tasks (such as those shown in recipe Retrieve Print Queue Information). You can also execute certain WMI class methods to interact with the Windows operating system. One example is the Pause and Resume methods that allow you to manage printers and print jobs.

The following Console application provides a straightforward example. Every time the application finds a print job in the queue, it checks to see if the job or the printer is paused. If so, it tries to resume the job or the printer. Note that Windows permissions might ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required