unit U_pert4;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, FileCtrl;
type
TForm3 = class(TForm)
Label1: TLabel;
Label2: TLabel;
Edit1: TEdit;
DirectoryListBox1: TDirectoryListBox;
FileListBox1: TFileListBox;
DriveComboBox1: TDriveComboBox;
Bevel1: TBevel;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
BitBtn3: TBitBtn;
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
Button1: TButton;
Button2: TButton;
ColorDialog1: TColorDialog;
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure FileListBox1Change(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form3: TForm3;
implementation
var NamaFile:String;
Atribut:Integer;
{$R *.dfm}
procedure TForm3.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 TForm3.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 TForm3.BitBtn3Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm3.Button1Click(Sender: TObject);
begin
if application.MessageBox('Apakah Anda Ingin Keluar?','Warning',36)=idyes then
close;
end;
procedure TForm3.Button2Click(Sender: TObject);
begin
colordialog1.Execute();
form3.Color:=colordialog1.Color;
end;
procedure TForm3.FileListBox1Change(Sender: TObject);
begin
BitBtn1Click(self);
end;
end.