Arsip: Mengganti attribut subfolder sekali waktu


by nickqin in Articles more 13 years ago 1271
Jika anda pernah mengalami kena virus local & folder-folder anda terhiden sekali klik. berikut penjelasan in Delphi
buat project baru
pasang 1 buah label dan 1 buah memo
simpan project di directory yg didalamnya ada beberapa folder sebagai sample.

procedure TForm1.FormCreate(Sender: TObject);
var
SearchRec : TSearchRec;
SearchDir,myfile : string;
begin
memo1.Clear;
MyFile := ExtractFilePath(ParamStr(0));
label1.caption:=myfile;
SearchDir := label1.Caption + '. ';
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
attrib:string;
i:byte;
begin
for i:=0 to memo1.Lines.count-1 do
begin
attrib:=label1.caption+memo1.lines.Strings[i];
filesetattr(attrib,faReadOnly + faHidden + fasysfile ); //set attribut file
end;
end;
Syntax Highlighted with https://pascal-id.org/syntax


semoga bermanfaat..!
kalo ada waktu berkunjung aja ke webku
http://www.geocities.com/nickqin2001/
Local Business Directory, Search Engine Submission & SEO Tools FreeWebSubmission.com SonicRun.com