Display Waktu Pada Caption


Tips & Trik Delphi, Tips Belajar Delphi, Belajar Delphi Online
unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls;

type
TForm1 = class(TForm)
Timer1: TTimer;
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;
dc: hDC;

implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
TheTime: array[0..80] of char;
begin
StrPCopy(TheTime, TimeToStr(time));
TextOut(dc, width DIV 2, 5, TheTime, StrLen(TheTime));
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
dc := GetWindowDC(handle);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
ReleaseDC(handle, dc);
end;

end.

TransCODE Software

2 pemikiran pada “Display Waktu Pada Caption

  1. mas mau tanya ni, saya kan buat aplikasi alarm (pake komponen datetimepicker,timer) trus disimpan ditrayicon gitu. tapi jika aplikasi sudah berjalan 1 sampai 2 jam gitu alarmnya gak aktif alias gak bekerja. penyebabnya apa ya?

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s