Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
Determine how long your Windows OS have been running. Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
Determine Windows running duration. 13-Mar-04
Category
System
Language
Delphi 2.x
Views
436
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
Darley, F. Joe
Reference URL:
			1   
2   //This procedure tells how long your PC have been running.
3   //NOTE: After 49.7 days windows starts over to zero in keeping track
4   //on how long its been running.
5   
6   procedure TForm1.Button1Click(Sender: TObject);
7   const
8   cDay= 86400000;
9   cHour=3600000;
10  cMin = 60000;
11  cSec = 1000;
12  var
13  
14  iTick:dword;
15  idays,iHour,iMin,iSec,iMil: integer;
16  sHold:string;
17  
18  begin
19    iTick:=gettickCount;
20    idays:= iTick div  cDay;  //calculates days
21    iHour:= (iTick mod cDay) div  cHour; //calculates Hours
22    iMin:= ((iTick mod cDay) mod  cHour) div cMin; //calculates minutes
23    iSec:=(((iTick mod cDay) mod  cHour) mod cMin) div cSec; //calculates Seconds
24    iMil:=(((iTick mod cDay) mod  cHour) mod cMin) mod cSec; //calculates Milliseconds
25    sHold:= 'This PC has been running for '+intTostr(iDays)+' Days, ';
26    sHold:=sHold+IntTostr(iHour)+' Hours, ';
27    sHold:=sHold+IntTostr(iMin)+' Minutes, ';
28    sHold:=sHold+IntTostr(iSec)+' Seconds, ';
29    sHold:=sHold+IntTostr(iMil)+' Mil Sec. ';
30  
31  showmessage(sHold);
32  
33  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC