What alternatives are available to WMI for obtaining the state of a printer?

What options are available in C#/.NET to get the status of an installed printer? The only information we need is if the printer is on or off (we have a little indicator on the screen that says 'Printer ready' or 'Printer offline').

Our application is a small client running on an embedded PC. We've found that the WMI Windows process is running out of memory. Watching it on my development PC there appears to be a memory leak as the amount of memory it uses slowly creeps up. On an embedded device with limited memory this is unacceptable and we're finding after a couple of hours the application crashes.

Answers


I would try to resolve the memory leak, but if you cant find it, you could always use PInvoke calls (specifically GetPrinterData). See an example here (Note: There are also WMI posts that could help you compare what you have and see if you can find the memory leak)


Need Your Help

Ajax Give Response but not Executing the PHP Service

jquery asp.net ajax

Am doing Ajax request to a file which sends a mail. It give me the correct response which is "Message Sent" but the mail not sent. When I try to execute that file from the browser with the same GET

iOS - what is the right way to deal with a data model change?

iphone ios core-data core-data-migration xcdatamodel

I already have an app in the app store. I want to do an upgrade. My local data store has changed, with an extra table, and with a few fields added in the existing table. I want to retain the data i...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.