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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:46:05+00:00 2026-05-26T19:46:05+00:00

I just discovered that some programs are very quick when getting/listing the directory of

  • 0

I just discovered that some programs are very quick when getting/listing the directory of network drives, almost instantly. I am talking about programs like FreeComanderXE and DirectoryOpus here.

In my program it takes several seconds to do the same task. What can I do to improve the speed here.

This is my code for loading the directory in a thread:

procedure LoadDirThread.Execute;
var
  PIdx: Integer;
  b: Boolean;
  n: Integer;
  FName: string;
  Item: TXplorerItem;
  i: Integer;
  Path: String;
  SR: TSearchRec;
  SFI: TSHFileInfo;
  FData: TXplorerItem;
begin
  inherited;
  if not XPlorerLink.Loaded then
  begin
    Path := XPlorerLink.Path;
    PIdx := XPlorerLink.PathList.IndexOf(Path);
    if PIdx = -1 then
      PIdx := XPlorerLink.PathList.Add(Path);

    if FindFirst(Path + '*.*', faAnyFile - faHidden, SR) = 0 then
    begin
      repeat
        if (SR.Name <> '.') and (SR.Name <> '..') then
        begin
          if (SR.Attr and faDirectory <> 0) then
          begin
            FData := TXplorerItem.Create;
            FName := Path + SR.Name;
            SHGetFileInfo(PChar(FName), 0, SFI, SizeOf(SFI), SHGFI_DISPLAYNAME or
              SHGFI_TYPENAME);
            FData.FAttr:= SR.Attr;
            FData.Kind := xiDir;
            FData.Size := 0;
            FData.Caption := Strpas(SFI.szDisplayName);
            if FData.Caption = '' then
              FData.Caption := ChangeFileExt(SR.Name, '');
            FData.Name := SR.Name;
            FData.Modified := FileDateToDateTime(SR.Time);
            FData.ImgIdx := -1;
            n := XPlorerLink.InfoList.IndexOf(SFI.szTypeName);
            if n = -1 then
              n := XPlorerLink.InfoList.Add(SFI.szTypeName);
            FData.InfoIdx := n;
            FData.PathIdx := PIdx;
            XPlorerLink.Items.Add(FData);
          end
          else
          if (SR.Attr and faDirectory = 0) then
          begin
            FData := TXplorerItem.Create;
            FName := Path + SR.Name;
            SHGetFileInfo(PChar(FName), 0, SFI, SizeOf(SFI), SHGFI_DISPLAYNAME or
              SHGFI_TYPENAME);
            FData.FAttr:= SR.Attr;
            FData.Kind := xiFile;
            FData.Size := SR.Size;
            FData.Caption := Strpas(SFI.szDisplayName);
            if FData.Caption = '' then
              FData.Caption := ChangeFileExt(SR.Name, '');
            FData.Name := SR.Name;
            FData.Modified := FileDateToDateTime(SR.Time);
            FData.ImgIdx := -1;
            n := XPlorerLink.InfoList.IndexOf(SFI.szTypeName);
            if n = -1 then
              n := XPlorerLink.InfoList.Add(SFI.szTypeName);
            FData.InfoIdx := n;
            FData.PathIdx := PIdx;
            XPlorerLink.Items.Add(FData);
          end;
        end;
      until (FindNext(SR) <> 0) or Terminated;
      FindClose(SR);
    end;
  end;
  if not Terminated then
    PostMessage(frmMain.Handle, CM_UPDATEVIEW, -2, Integer(XPlorerLink));
end;
  • 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-26T19:46:06+00:00Added an answer on May 26, 2026 at 7:46 pm

    Change your code to use the IShellFolder interface instead of the Find...() functions. Everything in the Windows Shell is internally represented by IShellFolder, ITEMIDLISTs, etc, even file system and network paths. When performance matters, use Windows’ own native data. Windows Explorer uses IShellFolder and related interfaces for all of its main work.

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

Sidebar

Related Questions

I just discovered that the caps lock and shift key (and probably some more
I just discovered that some parts of the code I am working on incorrectly
I'm having some trouble. I just discovered that you can control vimeo with js,
I just discovered that %ws was common knowledge (to some), for formatting unicode strings,
To my amazement I just discovered that the C99 stdint.h is missing from MS
I've just discovered that Oracle lets you do the following: SELECT foo.a, (SELECT c
I have just discovered that if generating assemblies via Reflection.Emit, the .NET framework keeps
I've just discovered that regtlib.exe appears to be missing from Windows 7 (and apparently
I have a website, and I just discovered that somehow someone injected JavaScript on
I only just recently discovered that Visual C++ 2008 (and perhaps earlier versions as

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.