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 ...
Get Microsoft® Visual Basic® .NET Programmer's Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.