Berikut ini adalah List Programnya :
interface
uses
Windows, Messages, SysUtils,
Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,
ExtCtrls, FileCtrl;
type
TForm1 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
FileListBox1: TFileListBox;
DirectoryListBox1:
TDirectoryListBox;
DriveComboBox1:
TDriveComboBox;
Bevel1: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
procedure
BitBtn1Click(Sender: TObject);
procedure
BitBtn2Click(Sender: TObject);
procedure
BitBtn3Click(Sender: TObject);
procedure
FileListBox1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
var
NamaFile:String;
Atribut:Integer;
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
begin
NamaFile:=Edit1.Text;
Atribut:=FileGetAttr(NamaFile);
if Atribut and
faReadOnly=faReadOnly then
checkbox1.Checked:=true
else
checkbox1.Checked:=false;
if Atribut and
faHidden=faHidden then
checkbox2.Checked:=true
else
checkbox2.Checked:=false;
if Atribut and
faSysFile=faSysFile then
checkbox3.Checked:=true
else
checkbox3.Checked:=false;
end;
procedure TForm1.BitBtn2Click(Sender: TObject);
begin
if checkbox1.Checked=true then
Atribut:=Atribut or
faReadOnly
else
Atribut:=Atribut and not
faReadOnly;
if checkbox2.Checked=true then
Atribut:=Atribut or faHidden
else
Atribut:=Atribut and not
faHidden;
if checkbox3.Checked=true then
Atribut:=Atribut or faSysFile
else
Atribut:=Atribut and not faSysFile;
FileSetAttr(NamaFile,Atribut);
end;
procedure TForm1.BitBtn3Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.FileListBox1Change(Sender: TObject);
begin
BitBtn1Click(Self);
end;
end.
Tidak ada komentar:
Posting Komentar