How to get the Symbol/Icon associated with a file or directory name

Discussion in 'Microsoft C# .NET' started by Alexander Keßler, Oct 15, 2004.

  1. Hi,

    I want to programm some kind of Explorer like the Windows Explorer.
    And I want to know how can i get the same Icons/Symbols for the files and
    directories like the Windows Explorer uses.

    Example:

    The Icon for the Desktop.

    With the Command:
    Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    I can get the folder where the Windows Desktop is located.

    But how can I get the standart icon for the desktop?
     
    Alexander Keßler, Oct 15, 2004
    #1
    1. Advertisements

  2. Unfortunately, I think you will need to use Win32 API for that.
    In shell32.dll there is SHGetFileInfo.





    --
    Regards,
    Dennis JD Myrén
    Oslo Kodebureau
    "Alexander Keßler" <> wrote in message
    news:cko62r$j03$-kl.de...
    > Hi,
    >
    > I want to programm some kind of Explorer like the Windows Explorer.
    > And I want to know how can i get the same Icons/Symbols for the files and
    > directories like the Windows Explorer uses.
    >
    > Example:
    >
    > The Icon for the Desktop.
    >
    > With the Command:
    > Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    > I can get the folder where the Windows Desktop is located.
    >
    > But how can I get the standart icon for the desktop?
    >
     
    Dennis Myrén, Oct 15, 2004
    #2
    1. Advertisements

  3. "Alexander Keßler" <> wrote in message
    news:cko62r$j03$-kl.de...
    > Hi,
    >
    > I want to programm some kind of Explorer like the Windows Explorer.
    > And I want to know how can i get the same Icons/Symbols for the files and
    > directories like the Windows Explorer uses.
    >
    > Example:
    >
    > The Icon for the Desktop.
    >
    > With the Command:
    > Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
    > I can get the folder where the Windows Desktop is located.
    >
    > But how can I get the standart icon for the desktop?
    >



    Hello Alexander,

    You'll have to use WinApi's SHGetFileInfo method. Check these:

    http://support.microsoft.com/?kbid=319350

    http://www.codeguru.com/Csharp/Csharp/cs_misc/icons/article.php/c4261/

    Note that for retrieving icons for individual files, it is much faster to
    use filename extension since it will fetch icons from the shell icon cache.

    HTH.

    Regards,

    Julijan
     
    Julijan Sribar, Oct 15, 2004
    #3
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Moses M
    Replies:
    6
    Views:
    668
    Willy Denoyette [MVP]
    Jun 25, 2004
  2. Alexander Keßler
    Replies:
    7
    Views:
    646
    Alexander Keßler
    Oct 16, 2004
  3. Chris Martinez via .NET 247
    Replies:
    0
    Views:
    642
    Chris Martinez via .NET 247
    Mar 11, 2005
  4. John

    Active directory users and associated groups

    John, Mar 14, 2005, in forum: Microsoft C# .NET
    Replies:
    2
    Views:
    168
  5. Visual Systems AB \(Martin Arvidsson\)

    How to get icon associated with a document.

    Visual Systems AB \(Martin Arvidsson\), Apr 28, 2005, in forum: Microsoft C# .NET
    Replies:
    1
    Views:
    160
Loading...

Share This Page