So sollte es funktionieren
Delphi-Quellcode:
if VerzName[length(VerzName)]<>'\' then
VerzName:=VerzName+'\';
with Form1 do begin
ListView.Items.Clear;
if FindFirst(VerzName+'*.*',faAnyFile,SR)=0 then begin
repeat
if (sr.Name <> '.') and (sr.Name <> '..') and ((sr.Attr and faDirectory) <> faDirectory) then begin
ext := ExtractFileExt(sr.Name);
if (ext = '.txt') or (ext = '.htm') or (ext = '.html') or (ext = '.php') then begin
NewItem := ListView.Items.Add;
NewItem.Caption := SR.Name;
SHGetFileInfo(PChar(VerzName+SR.Name),
0,Info,SizeOf(TSHFileInfo),SHGFI_SYSIconIndex
or SHGFI_TYPENAME);
NewItem.ImageIndex := Info.IIcon;
NewItem.SubItems.Add(Info.szTypeName);
end;
end;
until FindNext(SR)<>0;
FindClose(SR);
end;
ListView.CustomSort(@NamenSortProc, 0);
end;
Eventuell solltest du noch die Extensions auf Gross/Kleinbuchstaben prüfen, wenn dies notwendig ist
Delphi-Quellcode:
[..]
ext := Uppercase(ExtractFileExt(sr.Name));
if (ext = '.TXT') or (ext = '.HTM') or (ext = '.HTML') or (ext = '.PHP') then begin
NewItem := ListView.Items.Add;