Re: Enumerating Local Physical Printers

Tech-Archive recommends: Speed Up your PC by fixing your registry



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.
.



Relevant Pages

  • Re: Enumerating Printer Drivers Help Please
    ... > I need to be able to Enumerate through Printer Drivers, ports, printers ... And even add printers, ports, and drivers and setup ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Enumerating Local Physical Printers
    ... rather difficult to reliably enumerate only local physical printers on ... The problem here is that many drivers, such as PDF and XPS document ... Did you try using the following API to enumerate the ...
    (microsoft.public.win32.programmer.wmi)
  • Re: Enumerating Printer Drivers Help Please
    ... I need to be able to Enumerate through Printer Drivers, ports, printers and so fourth. ... I have added a reference to the PRNADMIN.DLL from MS Windows 2003 Tool Kit into my project to do all of the above, but when i try to enumerate printers i received the following error.... ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Cant print without restarting Print Spooler Service
    ... Once you get the drivers removed download the latest from HP and start over. ... The 3 printers are standalone network devices and are not attached to the ... file server directly. ...
    (microsoft.public.windowsxp.print_fax)
  • Re: Moving Printers
    ... Download the latest drivers for Windows2000 and Windows XP. ... Install the printer on the server using the "Have Disk" option to browse ... drivers on the XP computers when they run the Install Printers Wizard.?? ...
    (microsoft.public.backoffice.smallbiz2000)