Search code examples
c#winapiprintingdot-matrix

How to detect type of selected printer that is dot matrix or not?


Normally, in old version Windows (98 or older) I can use MarkingTechnology in Printer api to get current type of printer. But it doesn't available in Windows 2000 or later. Do you have any other way to detect it in Windows 2000 or later?

Example code for query printer information via WMI Query in C#

var queryResult = string.Empty;
var query = new WqlObjectQuery("Select * from Win32_Printer");
var searcher = new ManagementObjectSearcher(query);

foreach (ManagementObject printer in searcher.Get())
{
    foreach (var p in printer.Properties)
    {
        queryResult += p.Name + ": " + printer[p.Name] + Environment.NewLine;
    }

    queryResult += "--------------------------------" + Environment.NewLine;
}

Win32_Printer class documentation

Thanks,


Solution

  • Short answer: No, there does not seem to be a consistent way to do this.