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

Retrieve Print Queue Information

Problem

You want to determine the status of all jobs in the print queue.

Solution

Use Windows Management Instrumentation to perform a query with the Win32_PrintJob class.

Discussion

Windows Management Instrumentation, or WMI, allows you to retrieve a vast amount of system information using a query-like syntax. One of the tasks you can perform with WMI is to retrieve a list of outstanding print jobs, along with information about each one.

In order to use WMI, you need to add a reference to the System.Management.dll assembly. You should then import the System.Management namespace. The following code assumes you have added a reference to the System.Management.dll assembly. It retrieves a list of all the print jobs in the ...

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