Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. determine whether a driver is a print driver or a fax driver

determine whether a driver is a print driver or a fax driver

Scheduled Pinned Locked Moved C#
question
4 Posts 2 Posters 2 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cobra2005
    wrote on last edited by
    #1

    Is there a way to determine whether an installed print driver (as shown in PrintDialog) is for a printer or a fax? PrinterSettings doesn't seem to provide that kind of information. cobra2005

    C 1 Reply Last reply
    0
    • C cobra2005

      Is there a way to determine whether an installed print driver (as shown in PrintDialog) is for a printer or a fax? PrinterSettings doesn't seem to provide that kind of information. cobra2005

      C Offline
      C Offline
      Curtis Schlak
      wrote on last edited by
      #2

      Okay, not sure on this, but give it a shot. (I don't have a fax hooked up to any printer....) Put the following in a Console Application and run it to see if you get what you want. If a "printer" is fax capable, then hopefully you will see it in the CapabilityDescriptions property. You need to add a reference to the System.Management.dll in your project.

      // Create a management class to get the printers.
      ManagementClass c = new ManagementClass( "Win32_Printer" );

      // Get the information for all the printers.
      ManagementObjectCollection moc = c.GetInstances();

      // Iterate over the objects.
      foreach( ManagementObject mo in moc )
      {
      string name = ( string ) mo.Properties[ "Caption" ].Value;
      string[] desc = ( string[] ) mo.Properties[ "CapabilityDescriptions" ].Value;
      Console.WriteLine( "{0}", name );
      foreach( string s in desc )
      {
      Console.WriteLine( "\t{0}", s );
      }
      Console.WriteLine();
      }

      If you don't see "Fax," or something like that, then iterate over all the properties of the ManagementObject and see if you can find something in there. Hope it helps. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

      C 2 Replies Last reply
      0
      • C Curtis Schlak

        Okay, not sure on this, but give it a shot. (I don't have a fax hooked up to any printer....) Put the following in a Console Application and run it to see if you get what you want. If a "printer" is fax capable, then hopefully you will see it in the CapabilityDescriptions property. You need to add a reference to the System.Management.dll in your project.

        // Create a management class to get the printers.
        ManagementClass c = new ManagementClass( "Win32_Printer" );

        // Get the information for all the printers.
        ManagementObjectCollection moc = c.GetInstances();

        // Iterate over the objects.
        foreach( ManagementObject mo in moc )
        {
        string name = ( string ) mo.Properties[ "Caption" ].Value;
        string[] desc = ( string[] ) mo.Properties[ "CapabilityDescriptions" ].Value;
        Console.WriteLine( "{0}", name );
        foreach( string s in desc )
        {
        Console.WriteLine( "\t{0}", s );
        }
        Console.WriteLine();
        }

        If you don't see "Fax," or something like that, then iterate over all the properties of the ManagementObject and see if you can find something in there. Hope it helps. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

        C Offline
        C Offline
        cobra2005
        wrote on last edited by
        #3

        Thanks Curtis. I need something more "robust". though. There is no capability listed for a fax driver and I can't use the driver/printer name because of localization issues (the app should be designed to work in other countries, as well). cobra2005

        1 Reply Last reply
        0
        • C Curtis Schlak

          Okay, not sure on this, but give it a shot. (I don't have a fax hooked up to any printer....) Put the following in a Console Application and run it to see if you get what you want. If a "printer" is fax capable, then hopefully you will see it in the CapabilityDescriptions property. You need to add a reference to the System.Management.dll in your project.

          // Create a management class to get the printers.
          ManagementClass c = new ManagementClass( "Win32_Printer" );

          // Get the information for all the printers.
          ManagementObjectCollection moc = c.GetInstances();

          // Iterate over the objects.
          foreach( ManagementObject mo in moc )
          {
          string name = ( string ) mo.Properties[ "Caption" ].Value;
          string[] desc = ( string[] ) mo.Properties[ "CapabilityDescriptions" ].Value;
          Console.WriteLine( "{0}", name );
          foreach( string s in desc )
          {
          Console.WriteLine( "\t{0}", s );
          }
          Console.WriteLine();
          }

          If you don't see "Fax," or something like that, then iterate over all the properties of the ManagementObject and see if you can find something in there. Hope it helps. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty

          C Offline
          C Offline
          cobra2005
          wrote on last edited by
          #4

          Thanks Curtis. I need something more "robust". though. There is no capability listed for a fax driver and I can't use the driver/printer name because of localization issues (the app should be designed to work in other countries, as well). Any other ideas? I've also tried Win32 API EnumPrinters with no luck. cobra2005

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups