Pergunta

What I am trying to do:

I am creating a database of all printer installed on a computer.

Using PrinterSetting.PrinterName and PrinterSettings.InstalledPrinters I am getting PrinterName.

I have also tried winapi Win32_Printer but this and my above code has a problem.

Problem

The problem is that a single printer can be installed by different names like HP LasetJet 1020, HP LasetJet 1020 (Copy 1), HP LasetJet 1020 (Copy 2), and so on. A printer name is user-defined and can be any. Even may be one printer can be installed by 2 such different names that they have no similarity between their names.

That's why i think Printer Model Name should be unique even if one printer is installed by different names.

Question:

How to extract that Printer Mode Name? or may be any other property in Win_32 that is unique, uneditable by user and can be used to identify printers.

OR

May be registry can be helpful for this. If this model information is in registry(Most probably it will be) where can it be found?

Foi útil?

Solução

The combination of printer driver name and port name form the only unique identifier for a specific printer. If the driver and port names match between two printers, then those printers both represent the same physical (or virtual) piece of hardware. No other properties reliably identify them.

Outras dicas

I'd tackle this with WMI, it looks like there might be a little more info that way.

There's a decent walkthrough on CodeProject, but I can't say I've dealt with this specifically, just thought I'd point you in that direction.

http://www.codeproject.com/Articles/80680/Managing-Printers-Programatically-using-C-and-WMI

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top