S
smilboy
Unregistered / Unconfirmed
GUEST, unregistred user!
.
..
[1]
[2]
[3]
file1
file2
我要的是[1],[2],[3]
下面的代码不成功
function IsValidDir(SearchRec:TSearchRec):Boolean;
begin
if (SearchRec.Attr=16) and
(SearchRec.Name<>'.') and
(SearchRec.Name<>'..') then
Result:=True
else
Result:=False;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
SearchRec: TSearchRec;
begin
if (FindFirst(edit1.Text, faDirectory, SearchRec)=0) then
begin
if IsValidDir(SearchRec) then
memo1.lines.add(SearchRec.Name);
while (FindNext(SearchRec) = 0) do
begin
if IsValidDir(SearchRec) then
memo1.Lines.Add(SearchRec.Name);
end;
end;
FindClose(SearchRec);
end;
..
[1]
[2]
[3]
file1
file2
我要的是[1],[2],[3]
下面的代码不成功
function IsValidDir(SearchRec:TSearchRec):Boolean;
begin
if (SearchRec.Attr=16) and
(SearchRec.Name<>'.') and
(SearchRec.Name<>'..') then
Result:=True
else
Result:=False;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
SearchRec: TSearchRec;
begin
if (FindFirst(edit1.Text, faDirectory, SearchRec)=0) then
begin
if IsValidDir(SearchRec) then
memo1.lines.add(SearchRec.Name);
while (FindNext(SearchRec) = 0) do
begin
if IsValidDir(SearchRec) then
memo1.Lines.Add(SearchRec.Name);
end;
end;
FindClose(SearchRec);
end;