Total Pageviews

Drink of the Day

Kabar BARU

Email Contact Form with Twitter, Facebook & Skype

translator

Powered by Blogger.

Ads 468x60px

Popular Posts

Blog Archive

Followers

Featured Posts Coolbthemes

RSS

Mengetahui Sudah Berapa Lama Windows Dijalankan




Dalam program Anda mungkin Anda ingin mengetahui sudah berapa lama Windows dijalankan pada saat itu. Untuk mengetahuinya Anda dapat menggunakan function di bawah ini.

function UpTime: string;
  1. const
  2.    ticksperday : integer = 1000 * 60 * 60 * 24;
  3.    ticksperhour : integer = 1000 * 60 * 60;
  4.    ticksperminute : integer = 1000 * 60;
  5.    tickspersecond : integer = 1000;
  6. var
  7.    t : longword;
  8.    d, h, m, s : integer;
  9.  
  10. begin
  11.      t := GetTickCount;
  12.  
  13.      d := t div ticksperday;
  14.      dec(t, d * ticksperday);
  15.  
  16.      h := t div ticksperhour;
  17.      dec(t, h * ticksperhour);
  18.  
  19.      m := t div ticksperminute;
  20.      dec(t, m * ticksperminute);
  21.  
  22.      s := t div tickspersecond;
  23.  
  24.      Result := 'Uptime: '+IntToStr(d)+ ' Hari '+IntToStr(h)+'      Jam '+IntToStr(m)+' Menit '+IntToStr(s)+' Detik';
  25. end;
Sedangkan contoh penggunaannya adalah sebagai berikut:
procedure TForm1.Button1Click(Sender: TObject);
  1. begin
  2.      Label1.Caption:=UpTime;
  3. end;

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comments:

Post a Comment

Recent Posts

iBlogger.web.id Aksesoris Blog Moody Blogger by Moch. Iqbal Chahyadi