unit u_pert4_AppOperasiFile;
interface
uses
Windows, Messages, SysUtils,
Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons,
ExtCtrls, FileCtrl;
type
TForm4 = class(TForm)
lbl1: TLabel;
lbl2: TLabel;
edt_nmFile: TEdit;
dirlst_1: TDirectoryListBox;
Fllst_1: TFileListBox;
drvcbb1: TDriveComboBox;
bvl1: TBevel;
btn_ok: TBitBtn;
btn_save: TBitBtn;
btn_close: TBitBtn;
grp1: TGroupBox;
chk_ReadOnly: TCheckBox;
chk_Hidden: TCheckBox;
chk_System: TCheckBox;
procedure btn_okClick(Sender:
TObject);
procedure
btn_saveClick(Sender: TObject);
procedure
btn_closeClick(Sender: TObject);
procedure
Fllst_1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form4: TForm4;
implementation
var
NmFile:string;
Atribut:Integer;
{$R *.dfm}
procedure TForm4.btn_okClick(Sender: TObject);
begin
NmFile:=edt_nmFile.Text;
Atribut:=FileGetAttr(NmFile);
if Atribut and faReadOnly = faReadOnly then
chk_ReadOnly.Checked:=True
else
chk_ReadOnly.Checked:=False;
if Atribut and faHidden = faHidden then
chk_Hidden.Checked:=True
else
chk_Hidden.Checked:=False;
if Atribut and faSysFile = faSysFile then
chk_System.Checked:=True
else
chk_System.Checked:=False;
end;
procedure TForm4.btn_saveClick(Sender: TObject);
begin
if chk_ReadOnly.Checked=True then
Atribut:=Atribut or faReadOnly
else
Atribut:=Atribut and not
faReadOnly;
if chk_Hidden.Checked=True then
Atribut:=Atribut or faHidden
else
Atribut:=Atribut and not
faHidden;
if chk_System.Checked=True then
Atribut:=Atribut or faSysFile
else
Atribut:=Atribut and not
faSysFile;
FileSetAttr(NmFile,Atribut);
end;
procedure TForm4.Fllst_1Change(Sender: TObject);
begin
btn_okClick(Self);
end;
procedure TForm4.btn_closeClick(Sender: TObject);
begin
Application.Terminate;
end;
Tidak ada komentar:
Posting Komentar