Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7183713
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:02:52+00:00 2026-05-28T18:02:52+00:00

I am able to successfully extract the icons for file system drives, folders and

  • 0

I am able to successfully extract the icons for file system drives, folders and files using the APIs I included below. Additional info on the DLL imports etc. that helped me get this far can be found here. By calling the method GetExtraLargeIconForFolder I get a 48×48 sized image in the icon.

public enum ImageListIconSize : int
{
    Large = 0x0,
    Small = 0x1,
    ExtraLarge = 0x2,
    Jumbo = 0x4
}

private static IImageList GetSystemImageListHandle(ImageListIconSize size)
{
    IImageList iImageList;
    Guid imageListGuid = new Guid("46EB5926-582E-4017-9FDF-E8998DAA0950");
    int ret = SHGetImageList(
        (int)size,
        ref imageListGuid,
        out iImageList
        );
    return iImageList;
}

public static Icon GetExtraLargeIconForFolder(string path)
{
    SHFILEINFO shinfo = new SHFILEINFO();
    IntPtr retVal = SHGetFileInfo(
        path, 0, ref shinfo, (uint)Marshal.SizeOf(shinfo),
        (int)(SHGetFileInfoConstants.SHGFI_SYSICONINDEX |
              SHGetFileInfoConstants.SHGFI_ICON));

    int iconIndex = shinfo.iIcon;
    IImageList iImageList =
        (IImageList)GetSystemImageListHandle(ImageListIconSize.ExtraLarge);
    IntPtr hIcon = IntPtr.Zero;
    if (iImageList != null)
    {
        iImageList.GetIcon(iconIndex,
            (int)ImageListDrawItemConstants.ILD_TRANSPARENT, ref hIcon);
    }

    Icon icon = null;
    if (hIcon != IntPtr.Zero)
    {
        icon = Icon.FromHandle(hIcon).Clone() as Icon;
        DestroyIcon(shinfo.hIcon);
    }
    return icon;
}

In Windows Explorer one sees, icons for the Desktop, Network and Computer. How does one go about getting the correct icon index for these file system nodes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:02:54+00:00Added an answer on May 28, 2026 at 6:02 pm

    You are nearly there. You still use SHGetFileInfo but instead you will need to pass SHGFI_PIDL in the flags parameter.

    Then you need to specify the shell object of interest by passing a PIDL rather than a path. Obtain the PIDL by calling SHGetSpecialFolderLocation. Pass a CSIDL value to this routine, e.g. CSIDL_DESKTOP, CSIDL_DRIVES, CSIDL_NETWORK etc.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am successfully able to extract images from a pdf using pdfsharp. The image
I'm able to successfully parse the contents of a XML file using TouchXML, but
I am able to extract my application apk file from PC. I am using
I am successfully able to authenticate Facebook and Google accounts using my Oauth2 servlets.
I was able to successfully run an RF model using some R code I
I can successfully parse the contents of a JSON file, using the JSON-Framework 3.0,
I'm able to successfully get a HMAC SHA1 signature key using the following code:
I have extract the JAR file with winrar, and i able to saw all
I am successfully able to send email using the smtplib module. But when the
I am able to successfully create a simple app that plays sound using the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.