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 }