jego jedynym problemem jest to ze nie moge zapisac do pliku wartosci ktore on znajduje- w tym tkwi moj caly problem. Pomozcie.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TFileName = type string;
THandle = LongWord;
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
public
{ Public declarations }
end;
var
Form1: TForm1;
mplementation
{$R .dfm}
procedure SearchDir(StartPath: string);
type
TSearchRec = record
Time: Integer;
Size: Integer;
Attr: Integer;
Name: TFileName;
FindHandle: THandle;
FindData: TWin32FindData;
end ;
var
SR: TSearchRec;
Found : Integer;
i: Integer;
TF : TextFile;
function IsDir(Value : string) : string;
begin
if Value[Length(Value)] <> '' then
Result := Value + '' else Result := Value;
end;
begin
Found := FindFirst(IsDir(StartPath) + '.*', faDirectory, SR);
while Found = 0 do
begin
Application.ProcessMessages;
if ((SR.Attr and faDirectory) = faDirectory) and ((SR.name <> '.') and (SR.name <> '..')) then
begin
SearchDir(IsDir(StartPath) + SR.name);
end
else
if ((SR.Attr and faDirectory) = 0) then
begin
if (AnsiLowerCase(ExtractFileExt(IsDir(StartPath) + SR.name)) = '.exe') then
end;
Found := FindNext(SR);
end;
begin
AssignFile (TF, 'c:/lista1.txt');
writeLn(TF, TSearchRec);
Rewrite (TF);
CloseFile(TF);
FindClose(SR);
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
SearchDir('c:\test');
end;
end.