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 837035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T05:04:51+00:00 2026-05-15T05:04:51+00:00

I am making a bread crumb bar in Delphi and having some problems regarding

  • 0

I am making a bread crumb bar in Delphi and having some problems regarding sorting the dropdown of the bread crumbs.

Strangely enough, even Vista is not consequent when showing these items.

I have tried many ways to figure out what is system folders, what is zip files and what is normal folders. It seems like an easy task but so far I have not found any good way of doing it.

One way is to use TypeDisplayName from TSHFileinfo but these are localized names so I can not be sure they will be in correct order in every language.

Here is the code I use to fill the menu:

  bool:= IsDesktop(SelectedPIDL);
  if bool then
    OleCheck(SHGetDesktopFolder(CurFolder))
  else
    OleCheck(DesktopShellFolder.BindToObject(SelectedPIDL, nil, IID_IShellFolder, Pointer(CurFolder)));
  if CurFolder.EnumObjects(0, SHCONTF_FOLDERS, EnumIDList) = NOERROR then
  begin
    while EnumIDList.Next(1, CurPidl, Fetched) = S_OK do
    begin
      FName:= GetDisplayName(CurFolder, CurPidl, SHGDN_NORMAL);
      Text:= GetPIDLNameForAddressBar(CurFolder, CurPidl);
      if bool then
        Text:= PSpecialFolderItem(SpecialFolders[0]).Name + '\' + Text;
      if Text[Length(Text)] <> '\' then
        Text:= Text + '\';
      NewPidl:= ConcatPIDLs(SelectedPIDL, CurPidl);
      SHGetFileInfo(PChar(NewPidl), 0, SFI, SizeOf(SFI), SHGFI_ATTRIBUTES or SHGFI_PIDL or
        SHGFI_SYSICONINDEX or SHGFI_TYPENAME);

      n:= SFI.dwAttributes;
      MenuList.Add(GetAttr(n) + FName);

      AddMenuItem(Text, FName, SFI.iIcon);
      CoTaskMemFree(CurPidl);
      CoTaskMemFree(NewPidl);
    end;
  end;
  CoTaskMemFree(SelectedPIDL);

Any solution for how to get the correct sorting order? It is strange there is no way in dwAttributes of TSHFileInfo to tell if a folder is a system folder.

Thanks to Keith Giddings I managed to come up with this solution:

  PidlList:= TList.Create;
  // Add PIDLs for sorting
  bool:= IsDesktop(SelectedPIDL);
  if bool then
    OleCheck(SHGetDesktopFolder(IShellFld))
  else
    OleCheck(DesktopShellFolder.BindToObject(SelectedPIDL, nil, IID_IShellFolder, Pointer(IShellFld)));
  if IShellFld.EnumObjects(0, SHCONTF_FOLDERS, EnumIDList) = NOERROR then
    while EnumIDList.Next(1, CurPidl, Fetched) = S_OK do
      PidlList.Add(CurPidl);
  // Sort it ...
  PidlList.Sort(ComparePIDLs);
  // Get display name and icon for item
  for i:= 0 to PidlList.Count - 1 do
  begin
    CurPidl:= PidlList[i];
    FName:= GetDisplayName(IShellFld, CurPidl, SHGDN_NORMAL);
    Text:= GetPIDLNameForAddressBar(IShellFld, CurPidl);
    if bool then
      Text:= PSpecialFolderItem(SpecialFolders[0]).Name + '\' + Text;
    if Text[Length(Text)] <> '\' then
      Text:= Text + '\';
    NewPidl:= ConcatPIDLs(SelectedPIDL, CurPidl);
    SHGetFileInfo(PChar(NewPidl), 0, SFI, SizeOf(SFI), SHGFI_ATTRIBUTES or SHGFI_PIDL or
      SHGFI_SYSICONINDEX or SHGFI_TYPENAME);
    AddMenuItem(Text, FName, SFI.iIcon);
    CoTaskMemFree(NewPidl);
  end;
  CoTaskMemFree(SelectedPIDL);
  for i:= PidlList.Count - 1 downto 0 do
  begin
    CoTaskMemFree(PidlList[i]);
    PidlList.Delete(i);
  end;
  // We are done free it
  PidlList.Free;

function ComparePIDLs(Item1, item2: Pointer): Integer;
begin
  Result:= SmallInt(IShellFld.CompareIDs(0, Item1, Item2));
end;

Roy M Klever

  • 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-15T05:04:52+00:00Added an answer on May 15, 2026 at 5:04 am

    How about using IShellFolder.CompareIds on all the pidls of your enumerated objects. That should allow you to put them in the same order as explorer does no matter which version of windows and whatever UI language.

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

Sidebar

Related Questions

Im making a program about the game Go and im trying to write some
I'm making some changes to a bit of our app that parses a csv
I am having trouble making a StringTokenizer break up a few lines of text
I'm making a website using JSP and servlets and I have to now break
Making lots of progress in a rails 3.1 to 3.2.6 upgrade for a Heroku
Making a new site but something is happening to it in IE8. The social
Making a word document of our network set-up. We have about 7 servers and
Making a new site but something is happening to it in IE. I've purchased
Making a simple application, so when the user logs out of Windows, it of
Making an adobe flex ui in which data that is calculated must use proprietary

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.