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

  • Home
  • SEARCH
  • 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 1035389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T14:32:06+00:00 2026-05-16T14:32:06+00:00

There is a nice feature in the Open Project… dialog (see image below) in

  • 0

There is a nice feature in the “Open Project…” dialog (see image below) in the NetBeans IDE which uses a custom icon for the folder symbols depending on the project type in that folder.

For example, if a folder contains a pom.xml file, the Maven project symbol appears.

Maybe there also an extension point in the Windows standard dialog or a shell view control which can be used to override the default folder icon.

All solutions I know so far need a system-wide change, but is there also a solution which works without system modifications and only for the current application?

alt text

Update: which VCL component would you suggest as a starting point for a custom dialog, could I use TShellTreeView or TcxShellTreeView?

  • 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-16T14:32:07+00:00Added an answer on May 16, 2026 at 2:32 pm

    Descending from ‘TCustomTreeView’, TShellTreeView has support for images out of the box. An ImageList can be assigned to its Images property, and in its OnGetImageIndex event the index of the image in the list for the corresponding node can be supplied.

    procedure TForm1.ShellTreeView1GetImageIndex(Sender: TObject; Node: TTreeNode);
    begin
      if TShellFolder(Node.Data).DisplayName = 'RAD Studio' then
        Node.ImageIndex := 2;
    end;
    

    A downside of that is, all nodes will have to use the images in the imagelist, that is there won’t be images from the system image list. The below example demonstrates how system images can be retrieved for nodes which won’t be customized. It uses a custom image for ‘RAD Studio’ folder in the personal folder and uses system images for all other nodes. ImageList1 holds our custom images, ImageList2 is the one that is assigned to the ‘Images’ property of the ‘ShellTreeView’.

    type
      TForm1 = class(TForm)
        [...]
      private
        FShellImageList: THandle;
        [...]
    
    uses
      shellapi, shellctrls, commctrl;
    
    procedure TForm1.FormCreate(Sender: TObject);
    var
      FileInfo: TSHFileInfo;
      ImageWidth, ImageHeight: Integer;
    begin
      ShellTreeView1.Root := 'rfPersonal';
    
      FShellImageList := SHGetFileInfo('C:\', 0, FileInfo, SizeOf(FileInfo),
          SHGFI_SYSICONINDEX or SHGFI_SMALLICON);     //'//(pop SO formatting)
      ImageList_GetIconSize(FShellImageList, ImageWidth, ImageHeight);
      ImageList2.Width := ImageWidth;
      ImageList2.Height := ImageHeight;
    
      // Arbitrary count hopefully sufficient enough to be able to hold
      // system images. Note that this is a proof of concept, not to be
      // intended to be a working design.
      ImageList_SetImageCount(ImageList2.Handle, 255);
    
      // Make sure the width/height of ImageList1 is the same.
      // Set its size, populate, stretchdraw do whatever necessary..
    end;
    
    function GetShellImage(PIDL: PItemIDList; Open: Boolean): Integer;
    var
      FileInfo: TSHFileInfo;
      Flags: Integer;
    begin
      Flags := SHGFI_PIDL or SHGFI_SYSICONINDEX or SHGFI_SMALLICON;
      if Open then Flags := Flags or SHGFI_OPENICON;
      SHGetFileInfo(PChar(PIDL), 0, FileInfo, SizeOf(FileInfo), Flags);
      Result := FileInfo.iIcon;
    end;
    
    procedure TForm1.ShellTreeView1GetImageIndex(Sender: TObject; Node: TTreeNode);
    var
      ImageIndex, SelectedIndex: Integer;
      Icon: TIcon;
    begin
      if TShellFolder(Node.Data).DisplayName = 'RAD Studio' then begin
        Icon := TIcon.Create;
        try
          ImageList1.GetIcon(0, Icon);
          ImageIndex := ImageList_AddIcon(ImageList2.Handle, Icon.Handle);
    
          ImageList1.GetIcon(1, Icon);
          SelectedIndex := ImageList_AddIcon(ImageList2.Handle, Icon.Handle);
        finally
          Icon.Free;
        end;
      end else begin
        ImageIndex := GetShellImage(TShellFolder(Node.Data).AbsoluteID, False);
        SelectedIndex := GetShellImage(TShellFolder(Node.Data).AbsoluteID, True);
    
        ImageList_ReplaceIcon(ImageList2.Handle, ImageIndex,
            ImageList_GetIcon(FShellImageList, ImageIndex, 0));
        ImageList_ReplaceIcon(ImageList2.Handle, SelectedIndex,
            ImageList_GetIcon(FShellImageList, SelectedIndex, 0));
      end;
      Node.ImageIndex := ImageIndex;
      Node.SelectedIndex := SelectedIndex;
    end;
    

    As commented in the code, this should not be taken for a working design; Instead of an imagelist having lots of unused images, some kind of a lookup that matches ‘image index’ and ‘system image list index’ could be employed.

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

Sidebar

Related Questions

There is a nice feature in Google Chrome when you do a search. It
Is there somewhere a one trick pony that just make all the nice feature
I'm digging through Google's results for free (open source) Java diff libaries, and there
Google Reader has a nice feature that when you switch to the web page
Google Code Project Hosting recently adapted CodeMirror to allow for quick in-browser editing of
I had recently stabilised developments of a major open source library written in Java.
On an iPad using Safari, go to this page: http://ifelse.org/projects/errors/viewport/test.html This is the Source:
I have to manually edit a few records in the (SQL 2008) database. I
I'm working on a system that will need to store a lot of documents
I am working on a rather large code base that has a bit of

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.