Newsgroups : Borland : borland.public.delphi.nativeapi.win32 : 2005 Mar : Findfirst directory order

www.cryer.info
Managed Newsgroup Archive

Findfirst directory order

Subject:Findfirst directory order
Posted by:"Glenn" (nospamhelp@key-data.co.uk)
Date:Sun, 20 Mar 2005 10:24:12

Hi

Delphi 4 with Paradox tables

I use the following code to display the file contents of a directory in a
listbox. This works fine and displays the contents in alphabetical order. Is
there any way I can allow the list order to be on the file last modified
date?
----------------------------
ListBox1.Items.Clear;
If ComboBox1.ItemIndex=0 then
FindFirst(DirectoryListBox1.Directory+'/*.doc', faAnyFile, SearchRec);
If ComboBox1.ItemIndex=1 then
FindFirst(DirectoryListBox1.Directory+'/*.jpg', faAnyFile, SearchRec);
If ComboBox1.ItemIndex=2 then
FindFirst(DirectoryListBox1.Directory+'/*.bmp', faAnyFile, SearchRec);
repeat;
begin
If SearchRec.Name<>'' then ListBox1.Items.Add(SearchRec.Name+'
('+DateToStr(FileDateToDateTime(SearchRec.Time))+')');
end;
until (FindNext(SearchRec) > 0);
Num:=IntToStr(x);
//TransSize:=FloatToStr(TransSize);
FindClose(SearchRec);
Screen.cursor:=crDefault;
----------------------------------------------------

Thanks for your time

Kind Regards

Glenn Greatwood
Key-Data Systems
www.key-data.co.uk

Replies:

www.cryer.info
Managed Newsgroup Archive