PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, September 18, 2022

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

 September 18, 2022     c#, dot-matrix, printing, winapi     No comments   

Issue

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.



Answered By - M.Stramm
Answer Checked By - Gilberto Lyons (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing