Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2002.04.15;
Скачать: CL | DM;

Вниз

Сортировка файлов   Найти похожие ветки 

 
Kate   (2002-04-03 10:08) [0]

Всем привет. Помогите, пожалуйста начинающему программисту. Подскажите, как отсортировать файлы в директории по времени создания. Спасибо.


 
MBo ©   (2002-04-03 10:34) [1]

в ListView подойдет?
7) Сортировка ListView в режиме vsReport при нажатии на заголовок колонки

function CustomDateSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
result:=0;
if strtodatetime(item1.SubItems[0])>strtodatetime(item2.SubItems[0]) then
Result :=1 else
if strtodatetime(item1.SubItems[0])<strtodatetime(item2.SubItems[0]) then
Result :=-1;
end;

function CustomNameSortProc(Item1, Item2: TListItem; ParamSort: integer): integer; stdcall;
begin
Result := CompareText(Item1.Caption,Item2.Caption);
end;

procedure TForm1.GetFilesClick(Sender: TObject);
var sr:tsearchrec;
Item: TListItem;
begin
if FindFirst("e:\*.*",faAnyFile, sr) = 0 then repeat
if (sr.Attr and faDirectory) <> sr.Attr then
begin
item:=lv1.items.add;
item.Caption:=sr.name;
Item.SubItems.Add(datetimetostr(filedatetodatetime(sr.time)));
end;
until FindNext(sr) <> 0;
FindClose(sr);
end;

procedure TForm1.lv1ColumnClick(Sender: TObject; Column: TListColumn);
begin
if column =lv1.columns[0] then
LV1.CustomSort(@CustomNameSortProc, 0)
else LV1.CustomSort(@CustomDateSortProc, 0)
end;



Страницы: 1 вся ветка

Текущий архив: 2002.04.15;
Скачать: CL | DM;

Наверх




Память: 0.46 MB
Время: 0.011 c
3-46241
Алена
2002-03-24 21:52
2002.04.15
База в одноранговой сети


3-46259
MixVictor
2002-03-25 20:37
2002.04.15
Бд на машине без Delphi


14-46496
Merlin
2002-03-07 12:36
2002.04.15
Дохлый осел (перевод с английского)


1-46311
Алекс555
2002-04-03 12:37
2002.04.15
Друзья, подскажите для чего нужны указатели, на простом примере


1-46382
LazorenkoX
2002-04-01 21:39
2002.04.15
Array of byte -->> Record