Windows - descobrindo a quanto tempo o windows esta ligado |
Top Previous Next |
|
function Uptime: string; var count,days,min,hours,seconds: Longint; begin Count := GetTickCount(); Count := Count div 1000; Days := Count div (24 * 3600); if Days > 0 then Count := Count - (24 * 3600 * Days); Hours := Count div 3600; If Hours > 0 Then Count := Count - (3600 * Hours); Min := Count div 60; Seconds := Count Mod 60; Result := IntToStr(Days) + ' dias ' + IntToStr(Hours ) + ' horas ' + IntToStr(Min ) + ' minutos ' + IntToStr(seconds) +' segundos '; end;
procedure TForm1.Button1Click(Sender: TObject); begin showmessage(uptime); end; |