Hallo,
hiermit kann man herrausfinden, wie lange Windows schon läuft.
Delphi-Quellcode:
function GetWinUpTime:
String;
const
Days: Integer = 1000 * 60 * 60 * 24;
Hours: Integer = 1000 * 60 * 60;
Minutes: Integer = 1000 * 60;
Seconds: Integer = 1000;
var
iTicks, iDay, iHour, iMin, iSec: Integer;
begin
iTicks := GetTickCount;
iDay := iTicks
div Days;
//Tage
Dec(iTicks, iDay * Days);
iHour := iTicks
div Hours;
//Stunden
Dec(iTicks, iHour * Hours);
iMin := iTicks
div Minutes;
//Minuten
Dec(iTicks, iMin * Minutes);
iSec := iTicks
div Seconds;
//Sekunden
Result := IntToStr(iDay) + '
Tage, ' +
IntToStr(iHour) + '
Stunden, ' +
IntToStr(iMin) + '
Minuten, ' +
IntToStr(iSec) + '
Sekunden';
end;
Und so kann man es aufrufen:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
begin
ShowMessage(GetWinUpTime);
end;
Grüsse, Daniel