procedure SerachFile(const Path: string); //Path必须带“\”号
var
StringList: TStringList;
SearchRec: TSearchRec;
begin
if FindFirst(Path + '*.*', faAnyFile, SearchRec) = 0 then
begin
StringList := TStringList.Create;
repeat
StringList.Add(SR.Name);
until FindNext(SR) <> 0;
FindClose(SR);
StringList.SaveToFile('c:\file.txt');
StringList.Free;
end;
end;
var
StringList: TStringList;
SearchRec: TSearchRec;
begin
if FindFirst(Path + '*.*', faAnyFile, SearchRec) = 0 then
begin
StringList := TStringList.Create;
repeat
StringList.Add(SR.Name);
until FindNext(SR) <> 0;
FindClose(SR);
StringList.SaveToFile('c:\file.txt');
StringList.Free;
end;
end;
解决方案 »
- DLL中使用SetTimer
- 请教:delphi中如何调用C#编写的dll啊.
- 我的程序怎么前几天编译后的EXE文件有近2M,今天编译后只有400K了,但却还是可以象以前那样运行,怎么回事?
- 怎么定义一个一维的数组?
- 怎样在一个单元文件中调用另一个单元文件的过程?????
- MDI,未先关闭自窗口就直接关闭主窗口时会报错。我想在主窗口的onClose事件中编程实现关闭所有的自窗口。怎么实现?
- 求PID算法中的参数自整定程序(C语言或DELPHI)--最好使用Z-N(Ziegler-Nichols)设定方法
- 关于数据集ApplyUpdates时候的问题
- (100分)decisionquery如何连结sql server2005
- Delphi并不是完美的化身!!
- 我的程序用的Access,,运行时出现“无法为更新引集定位:一些值可能已在最后读取后改变”什么原因?
- 如何设置meomo控件行间距?
undeclared identifier :'SR'
請問如何宣告這一變數?
var
StringList: TStringList;
SR: TSearchRec;
begin
if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
begin
StringList := TStringList.Create;
repeat
StringList.Add(SR.Name);
until FindNext(SR) <> 0;
FindClose(SR);
StringList.SaveToFile('c:\file.txt');
StringList.Free;
end;
end;
var
StringList: TStringList;
SR: TSearchRec;
begin
if FindFirst(Path + '*.*', faAnyFile, SR) = 0 then
begin
StringList := TStringList.Create;
repeat
StringList.Add(SR.Name);
until FindNext(SR) <> 0;
FindClose(SR);
StringList.SaveToFile('c:\file.txt');
StringList.Free;
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
Form1: TForm1;
StringList: TStringList;
SR: TSearchRec;
SearchRec: TSearchRec;
path:string;
begin
path:='c:\windows\'; if FindFirst(Path + '*.*', faAnyFile, SearchRec) = 0 then
begin
StringList := TStringList.Create;
repeat
StringList.Add(SR.Name);
until FindNext(SR) <> 0;
FindClose(SR);
StringList.SaveToFile('c:\file.txt');
StringList.Free;
end;
end;
procedure SerachFile(const Path: string); //Path必须带“\”号
var
StringList:TStringlist;
SR:TSearchRec;
begin
if FindFirst(Path+'*.*',faAnyFile,SR)=0 then
begin
Stringlist:=TStringlist.Create;
repeat
Stringlist.add(sr.name);
until findNext(SR)<>0;
findClose(SR);
StringList.SaveToFile('C:\file.txt');
Stringlist.free
end;
end;
if FindFirst(Path + '*.*', faAnyFile, SR) = 0 就可以了。