Вниз
Скачать: CL | DM;

ПоЙИск Файлов???   Найти похожие ветки 

← →
Fog ©   (2003-08-08 23:01) [0]

Блин, уже 3 дня мучаюсь.. Немогу придумать алгоритм поиска файлов... Помогите!
зы:
ДА Я ЗНАЮ ФЦНКЦИИ FindFirs, FindNext, FileSearch!!!


← →
Palladin ©   (2003-08-08 23:05) [1]

а в принципе чем тебе помочь то?


← →
ferrik ©   (2003-08-08 23:06) [2]

Функции FindFirst и FindNext не устраивают?


← →
Vulko ©   (2003-08-08 23:15) [3]


> Fog ©

Во всех факах есть то, что тебе нужно.


← →
Fog ©   (2003-08-09 00:37) [4]

Ну хотябы подскажите как создать список всех вложенных папок в TStringList или String (Path1;Path2;path3)...


← →
Vulko ©   (2003-08-09 03:14) [5]

Раз не понимаешь, как найти папки или файлы с помощью FindFirst и FindNext, то сделай проще. Есть такой компонент - DirectoryListBox. Дальше я думаю всё ясно.


← →
Дмитрий Белькевич   (2003-08-09 03:15) [6]

function TForm1.GetFileList(FDirectory, Filter: string): TStringList;
var
ARec: TSearchRec;
Res: Integer;
DirList: TStringList;
FDir: TFileName;
begin
FDir := FDirectory;
if FDir[Length(FDir)] <> "\" then
FDir := FDir + "\";
Result := TStringList.Create;
DirList := TStringList.Create;
try
Res := FindFirst(FDir + "*", faAnyFile or faDirectory, ARec);
while Res = 0 do
begin
Application.ProcessMessages;
if ((ARec.Attr and faDirectory) > 0)
and (ARec.Name <> ".")
and (ARec.Name <> "..") then
DirList.Add(FDir + ARec.Name + "\");
if (ARec.Attr and faDirectory) = 0 then
if (MatchesMask(ARec.Name, Filter)) or (Filter = "*.*")then
Result.Add(FDir + ARec.Name);
Res := FindNext(ARec);
if (Res <> 0) and (DirList.count <> 0) then
begin
FindClose(ARec);
FDir := DirList.Strings[0];
DirList.Delete(0);
Res := FindFirst(FDir + "*", faAnyFile or faDirectory,
ARec);
end;
( ARec)
function TForm1.GetFileList(FDirectory, Filter: string): TStringList;
var
ARec: TSearchRec;
Res: Integer;
DirList: TStringList;
FDir: TFileName;
begin
FDir := FDirectory;
if FDir[Length(FDir)] <> "\" then
FDir := FDir + "\";
Result := TStringList.Create;
DirList := TStringList.Create;
try
Res := FindFirst(FDir + "*", faAnyFile or faDirectory, ARec);
while Res = 0 do
begin
Application.ProcessMessages;
if ((ARec.Attr and faDirectory) > 0)
and (ARec.Name <> ".")
and (ARec.Name <> "..") then
DirList.Add(FDir + ARec.Name + "\");
if (ARec.Attr and faDirectory) = 0 then
if (MatchesMask(ARec.Name, Filter)) or (Filter = "*.*")then
Result.Add(FDir + ARec.Name);
Res := FindNext(ARec);
if (Res <> 0) and (DirList.count <> 0) then
begin
FindClose(ARec);
FDir := DirList.Strings[0];
DirList.Delete(0);
Res := FindFirst(FDir + "*", faAnyFile or faDirectory,
ARec);
end;
end;
FindClose(ARec);
form5.Hide;
except
FindClose(ARec);
Result.Free;
form5.Hide;
end;
end;


← →
Proger_XP ©   (2003-08-09 11:34) [7]

можно проще
текст модуля:

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, FileCtrl;

type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
ListBox1: TListBox;
DirectoryListBox1: TDirectoryListBox;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.Button1Click(Sender: TObject);
var sr:TSearchRec;
Result:word;
begin
Result := FindFirst ("*.exe",faAnyFile,sr);
ListBox1.Clear;
While result=0 do
Begin
Result:=FindNext (sr);
ListBox1.Items.add(sr.name);
End;
end;

end.


← →
Fog ©   (2003-08-09 16:17) [8]


> Дмитрий Белькевич

То что нужно!!! Спасибо огромное!!!



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

Скачать: CL | DM;



Память: 0.47 MB
Время: 0.014 c
4-82018
Nicky
2003-06-17 18:27
2003.08.25
менюшка на менюшке


3-81551
M_A_R_T
2003-08-01 03:52
2003.08.25
Как получить список поставщиков данных?


14-81876
Study
2003-08-07 11:23
2003.08.25
Skins


1-81689
hoy
2003-08-11 01:00
2003.08.25
richedit и т.п.


14-81889
Шишкин Илья
2003-08-01 09:59
2003.08.25
Вопрос по BASS




   Наверх