Search results for 'TickCount'. 1 post(s) found.
- 2007/08/25 How To Get Windows Uptime
Find how long Windows has been working...
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);
h := t div ticksperhour;
dec(t, h * ticksperhour);
m := t div ticksperminute;
dec(t, m * ticksperminute);
s := t div tickspersecond;
Result := 'Uptime: '+IntToStr(d)+ ' Days '+IntToStr(h)+' Hours '+IntToStr(m)+' Minutes '+IntToStr(s)+' Seconds';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:=Uptime;
end;
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);
h := t div ticksperhour;
dec(t, h * ticksperhour);
m := t div ticksperminute;
dec(t, m * ticksperminute);
s := t div tickspersecond;
Result := 'Uptime: '+IntToStr(d)+ ' Days '+IntToStr(h)+' Hours '+IntToStr(m)+' Minutes '+IntToStr(s)+' Seconds';
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
label1.Caption:=Uptime;
end;
This is useful function for making Remote Management application that have to check system status frequently.
I used this function to reboot at certain condition such as Uptime.
Another posts included in "Delphi"
| How To Make Rounded Windows (0) | 2007/08/25 |
| How To Pass The Focus To The Next/prior Control (0) | 2007/08/25 |
| How To Make An Animated Application Icon (0) | 2007/08/25 |
| How To Find Out Total And Available Memory (0) | 2007/08/25 |
| How To Change The System Time (0) | 2007/08/25 |
| How To Get The Windows OS Version (0) | 2007/08/25 |
| How To Change The Desktop Wallpaper (0) | 2007/08/25 |
| How To Get The Windows Language (0) | 2007/08/25 |
Trackback : Cannot send a trackbact to this post.
-
Subject different money making ideas
2010/01/29 00:02
moneyideas
-
Subject different money making ideas
2010/01/29 08:23
moneyideas
-
Subject different money making ideas
2010/01/31 16:41
moneyideas

Prev

Rss Feed