At Delphi, we can know how much time Windows has been running.
Example: create a form with 4 Label, 4 Edit and a Button. In the Button1 OnClick event, write the following program listing:
procedure Tform1.Button1Click(Sender: TObject);
var WinTime : longword;
Hari, Jam, Menit, Detik : integer;
begin
WinTime:=GetTickCount;
Hari := WinTime div (1000 * 60 * 60 * 24);
dec(WinTime, Hari * (1000 * 60 * 60 * 24));
Jam := WinTime div (1000 * 60 * 60);
dec(WinTime, Jam * (1000 * 60 * 60));
Menit := WinTime div (1000 * 60);
dec(WinTime, Menit * (1000 * 60));
Detik := WinTime div 1000;
Edit1.Text:=IntToStr(Hari);
Edit2.Text:=IntToStr(Jam);
Edit3.Text:=IntToStr(Menit);
Edit4.Text:=IntToStr(Detik);
end;

No comments:
Post a Comment