-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTimedShutdown.pas
107 lines (89 loc) · 2.24 KB
/
TimedShutdown.pas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
unit TimedShutdown;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls, main, Spin;
type
TTimedShutdownForm = class(TForm)
Timer1: TTimer;
StartBtn: TBitBtn;
StopBtn: TBitBtn;
UrLabel: TLabel;
Timer2: TTimer;
Ur: TLabel;
Status: TLabel;
HandlingsType: TComboBox;
Label1: TLabel;
Timer: TSpinEdit;
Min: TSpinEdit;
TimerLabel: TLabel;
Label3: TLabel;
procedure Timer2Timer(Sender: TObject);
procedure StartBtnClick(Sender: TObject);
procedure StopBtnClick(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
TimedShutdownForm: TTimedShutdownForm;
implementation
{$R *.dfm}
procedure TTimedShutdownForm.Timer2Timer(Sender: TObject);
begin
Ur.Caption:=TimeToStr(GetTime);
end;
procedure TTimedShutdownForm.StartBtnClick(Sender: TObject);
begin
Timer1.Enabled:=True;
Status.Caption:='Tæller startet!';
end;
procedure TTimedShutdownForm.StopBtnClick(Sender: TObject);
begin
Timer1.Enabled:=False;
Status.Caption:='Tæller stoppet!';
end;
procedure TTimedShutdownForm.Timer1Timer(Sender: TObject);
var
Tidspunkt: string;
begin
Tidspunkt:=Timer.Text+':'+Min.Text+':'+'00';
If Tidspunkt=TimeToStr(GetTime) then
begin
Timer1.Enabled:=false;
if HandlingsType.ItemIndex=0 then
begin
Shutdown.ActionType:=aatShutdown;
Shutdown.Execute;
end;
if HandlingsType.ItemIndex=1 then
begin
Shutdown.ActionType:=aatReboot;
Shutdown.Execute;
end;
if HandlingsType.ItemIndex=2 then
begin
Shutdown.ActionType:=aatLogOff;
Shutdown.Execute;
end;
if HandlingsType.ItemIndex=3 then
begin
Shutdown.ActionType:=aatSuspend;
Shutdown.Execute;
end;
if HandlingsType.ItemIndex=4 then
begin
Shutdown.ActionType:=aatHibernate;
Shutdown.Execute;
end;
end;
end;
// Indstiller AlphaBlend.
procedure TTimedShutdownForm.FormCreate(Sender: TObject);
begin
AlphaBlendValue:=Main.Trans;
end;
end.