Re: Enumerating Local Physical Printers
- From: "Mr. Benjamin Strauss" <benstrauss@xxxxxxxx>
- Date: Fri, 12 Sep 2008 06:31:16 -0700 (PDT)
On Sep 5, 2:27 pm, Kellie Fitton <KELLIEFIT...@xxxxxxxxx> wrote:
On Sep 4, 1:51 pm, "Mr. Benjamin Strauss" <benstra...@xxxxxxxx> wrote:
Although it seems like it should be quite simple, it turns out to be
rather difficult to reliably enumerate only localphysicalprinters on
a machine. An obvious starting point would be something like:
Select * fromWin32_Printerwhere Local=true and Network=false
The problem here is that many drivers, such as PDF and XPS document
writers and fax drivers masquerading as printers are also turned up in
such an enumeration.
Alright, then, you say, we should at least be able to exclude fax
drivers by looking at the PRINTER_ATTRIBUTE_FAX bit of the Attributes
property? Well, sometimes, with some drivers.
Okay, then, if we're willing to limit ourselves to COM, LPT and USB
ports shouldn't we be able to use something like:
Select * fromWin32_Printerwhere Local=true and Network=false and
(PortName like 'COM%' or PortName like 'LPT%' or PortName like 'USB%')
Well, not quite. It seems that there are a good number of virtual
printer drivers that needlessly claim to be on an LPT port, despite
their wholly virtual nature. (I've come across the "Time America PDF
Maker", for instance, which claims to be on LPT1:.)
Has anybody nailed this one down? It seems that there should be an
attribute bit somewhere that would unequivocally correlate with
whether a printer isphysicalor not.
Hi,
Did you try using the following API to enumerate the
locally installed printers:
EnumPrinters()
http://msdn.microsoft.com/en-us/library/ms536005(VS.85).aspx
Kellie.- Hide quoted text -
- Show quoted text -
Yes, I've tried this (specifying PRINTER_ENUM_LOCAL) to no avail.
Such drivers as the "Send to OneNote 2007" and the "Microsoft XPS
Document Writer" are enumerated as though they were local printers.
By the way, I was really looking for a WMI approach to this. After
all, this is a WMI newsgroup.
.
- References:
- Enumerating Local Physical Printers
- From: Mr. Benjamin Strauss
- Re: Enumerating Local Physical Printers
- From: Kellie Fitton
- Enumerating Local Physical Printers
- Prev by Date: Connection Options
- Next by Date: Memory leak in WMI when querying event logs
- Previous by thread: Re: Enumerating Local Physical Printers
- Next by thread: Authentication on remote machine
- Index(es):
Relevant Pages
|