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. WPF
  4. Retrieving icons associated with installed Printers for use in C# and WPF

Retrieving icons associated with installed Printers for use in C# and WPF

Scheduled Pinned Locked Moved WPF
csharpwpfsysadmintutorialquestion
6 Posts 3 Posters 0 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.
  • A Offline
    A Offline
    Alisaunder
    wrote on last edited by
    #1

    I'm creating a ComboBox in my project that lists the installed Printers on my network. I have already been successful in creating the list and layout I wanted. But, I want to be able to display the same icons that you see next to them when you display your list in Vista or Windows 7. I have found a few articles online with people attempting the same thing but none that I have found have a real answer on how to go about this. Currently I am using System.Management to acquire all of the information I need about the installed Printers with the exception of course to the icons. Anyone have any suggestions on how to do this?

    S W 2 Replies Last reply
    0
    • A Alisaunder

      I'm creating a ComboBox in my project that lists the installed Printers on my network. I have already been successful in creating the list and layout I wanted. But, I want to be able to display the same icons that you see next to them when you display your list in Vista or Windows 7. I have found a few articles online with people attempting the same thing but none that I have found have a real answer on how to go about this. Currently I am using System.Management to acquire all of the information I need about the installed Printers with the exception of course to the icons. Anyone have any suggestions on how to do this?

      S Offline
      S Offline
      SledgeHammer01
      wrote on last edited by
      #2

      Use SHGetFileInfo to enumerate the printers virtual directory.

      A 1 Reply Last reply
      0
      • S SledgeHammer01

        Use SHGetFileInfo to enumerate the printers virtual directory.

        A Offline
        A Offline
        Alisaunder
        wrote on last edited by
        #3

        Yeah I read one link with that on it but I've never done anything like that so don't have a clue how too.

        1 Reply Last reply
        0
        • A Alisaunder

          I'm creating a ComboBox in my project that lists the installed Printers on my network. I have already been successful in creating the list and layout I wanted. But, I want to be able to display the same icons that you see next to them when you display your list in Vista or Windows 7. I have found a few articles online with people attempting the same thing but none that I have found have a real answer on how to go about this. Currently I am using System.Management to acquire all of the information I need about the installed Printers with the exception of course to the icons. Anyone have any suggestions on how to do this?

          W Offline
          W Offline
          Wayne Gaylard
          wrote on last edited by
          #4

          How to use the SHGetFileInfo function[^] is an example from MS on how to get associated icons. Good luck!

          When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

          A 1 Reply Last reply
          0
          • W Wayne Gaylard

            How to use the SHGetFileInfo function[^] is an example from MS on how to get associated icons. Good luck!

            When I was a coder, we worked on algorithms. Today, we memorize APIs for countless libraries — those libraries have the algorithms - Eric Allman

            A Offline
            A Offline
            Alisaunder
            wrote on last edited by
            #5

            Wayne, thank you this will help me understand that a great deal. But, I am retrieving the installed printer information by using System.Management and querying Win32. I can simply add image references and display them next to those if that was all there was to it. But, I was wanting to know if there was a way when retrieving the list information to determine which image was being used to represent them or do I simply create that myself? If you open your devices and printers right now you will see a fax icon next to a fax, a printer next to a printer, and a networked printer icon next to a networked one. Is the information used to display the proper image able to be retrieved in the same manner as obtaining the printer list or do I have to setup some sort of code that can determine if the printer information received is a fax and have it display a fax image?

            S 1 Reply Last reply
            0
            • A Alisaunder

              Wayne, thank you this will help me understand that a great deal. But, I am retrieving the installed printer information by using System.Management and querying Win32. I can simply add image references and display them next to those if that was all there was to it. But, I was wanting to know if there was a way when retrieving the list information to determine which image was being used to represent them or do I simply create that myself? If you open your devices and printers right now you will see a fax icon next to a fax, a printer next to a printer, and a networked printer icon next to a networked one. Is the information used to display the proper image able to be retrieved in the same manner as obtaining the printer list or do I have to setup some sort of code that can determine if the printer information received is a fax and have it display a fax image?

              S Offline
              S Offline
              SledgeHammer01
              wrote on last edited by
              #6

              You get that info with SHGetFileInfo. It gives you the HICON back if you call it appropriately.

              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