function UpTime: string;
const
ticksperday: Integer = 1000*60*60*24;
ticksperhour: Integer = 1000*60*60;
ticksperminute: Integer = 1000*60;
tickspersecond: Integer = 1000;
var
t:Longword;
d, h, m, s: Integer;
begin
t := GetTickCount;
d := t div ticksperday;
Dec(t, d * ticksperday);
Dec(t, h * ticksperhour;(
m := t div ticksperminute;
Dec(t, m * ticksperminute);
Result := "مدت
زمان روشن بودن کامپیوتر شما: "
+ IntToStr(d) + " روز" + IntToStr(h) + " ساعت " + IntToStr(m) +
" دقیقه "+ IntToStr(s) + " ثانیه";
end;
مثال:
button یک برچسب و یک روی فرم بذار و در رویداد کلیک مربوط به کلید بنویس
procedure
TForm1.Button1Click(Sender: T);
begin
label1.Caption := UpTime;
end;
موفق و سربلند باشید