Friday, 15 January 2010

c# - Why is it so difficult to find the printer status in windows? -



c# - Why is it so difficult to find the printer status in windows? -

using c# - i'm trying find list of printers local , online (i.e. connected , ready take print requests)

i know printer driver works - jobs wait until printer online, need find specific online. these available windows .net framework doesn't seem accurately expose online.

i'm trying utilize lots of different methods , none seem accurately work

// list of available printers. var printserver = new printserver(); var printqueues = printserver.getprintqueues(new[] { enumeratedprintqueuetypes.local, enumeratedprintqueuetypes.connections }); foreach (printqueue printqueue in printqueues) { console.writeline(printqueue.isoffline); // works isoffline, doesn't tell online - , it's not inverse relationship }

very frustrating - help appreciated.

should add together i'm using windows 8.1, , solution should work win 7+

edit:

so given next collection of printers :

i expect see along lines of

getting printers send onenote 2013 : online pack1 : offine microsoft xps document author : online fax : online epsonb12b28 (xp-412 413 415 series) : offine brother mfc-9970cdw printer : online

but reported online on status see

i have queried every conceivable windows device either native driver or using windows management instrumentation (wmi) classes.

to started, take read of article c# source: http://www.codeproject.com/articles/80680/managing-printers-programatically-using-c-and-wmi

also, not in c# vb, quick glance info on same subject here: http://msdn.microsoft.com/en-us/library/aa394598(v=vs.85).aspx

full wmi reference here: http://msdn.microsoft.com/en-us/library/aa394572(v=vs.85).aspx

cheers , luck!

c# .net wpf windows printing

No comments:

Post a Comment