Auto Shutdown

procedure TForm1.FormShow(Sender: TObject);
begin
DateTimePicker1.Time:=Now;
Timer1.Enabled:=false;
end;

procedure TForm1.btnkeluarClick(Sender: TObject);
begin
close;
end;

procedure TForm1.btnaktifkanClick(Sender: TObject);
begin
if btnaktifkan.Caption=’Aktifkan Auto Shutdown’ then
begin
timer1.Enabled:=true;
DateTimePicker1.Enabled:=false;
btnaktifkan.Caption:=’Batalkan Auto Shutdown’;
Application.Minimize;
end
else
begin
timer1.Enabled:=false;
DateTimePicker1.Enabled:=true;
btnaktifkan.Caption:=’Aktifkan Auto Shutdown’;
end;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
var
j1,m1,d1,md1 : Word;
j2,m2,d2,md2 : word;
begin
DecodeTime(now,j1,m1,d1,md1);
DecodeTime(DateTimePicker1.Time,j2,m2,d2,md2);
if (j2=j1) and (m2=m1) and (d2=d1) then
begin
btnaktifkan.Click;
ExitWindowsEx(EWX_SHUTDOWN,0);
end;
end;

end.

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: