Articles   Members Online: 3
-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. 15-Mar-04
Category
System
Language
CBuilder All Versions
Views
542
User Rating
8.333333
# Votes
3
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   void __fastcall TForm1::Button1Click(TObject *Sender)
7   {
8     const int  cDay= 86400000;
9     const int  cHour=3600000;
10    const int cMin =60000;
11    const int cSec = 1000;
12    DWORD iTick;
13    int idays,iHour,iMin,iSec,iMil;
14    String sHold="";
15  
16    iTick =GetTickCount();
17    idays = iTick / cDay;  //calculates days
18    iHour= (iTick % cDay) / cHour; //calculates Hours
19    iMin= ((iTick % cDay) %  cHour) / cMin; //calculates minutes
20    iSec=(((iTick % cDay) %  cHour) % cMin) / cSec; //calculates Seconds
21    iMil=(((iTick % cDay) %  cHour) % cMin) % cSec; //calculates Milliseconds
22    sHold= "This PC has been running for ";//+intTostr(iDays)+' Days, ';
23    sHold=sHold+IntToStr(iHour)+" Hours, ";
24    sHold=sHold+IntToStr(iMin)+" Minutes, ";
25    sHold=sHold+IntToStr(iSec)+" Seconds, ";
26    sHold=sHold+IntToStr(iMil)+" Mil Sec. ";
27    ShowMessage(sHold);
28  }


			
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