delphidelphi-xe6findfirst

FindFirst returns folders in English - Delphi


Good morning ... I am listing all files in a directory ... But I am facing the following problem ... When folders are coming All in English ... But the operating system is Ministry of Defence for the Portuguese ... How to list it according to the operating system language:

Ex: Program Files (EN) -> Arquivos de Programa (PT)

if FindFirst (directory + '*. *', faAnyFile, search_rec) = 0 then
       begin
         repeat
           Form4.ListView1.Items.Add.Caption: = search_rec.Name;
             lista.Add (search_rec.Name);
         Until FindNext (search_rec) <> 0;

         FindClose (search_rec);
       end;

Solution

  • Ok Portuguese:

    SHGetFileInfo(PChar(strPath + SearchRec.Name), 0, FileInfo,
                      SizeOf(FileInfo), SHGFI_DISPLAYNAME);
                    Listitem.Caption := FileInfo.szDisplayName;