Membuat Alarm dengan Delphi
Berikut ini akan saya contohkan bagaimana cara membuat alarm dengan menggunakan delphi .
Inilah daftar program yang digunakan
unit jam;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls, Menus;
type
TForm1 = class(TForm)
Timer1: TTimer;
PopupMenu1: TPopupMenu;
SetAlarm1: TMenuItem;
Alarmoff1: TMenuItem;
Exit1: TMenuItem;
Label1: TLabel;
Informasi1: TMenuItem;
procedure ontimer(Sender: TObject);
procedure SetAlarm1Click(Sender: TObject);
procedure Alarmoff1Click(Sender: TObject);
procedure Exit1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Informasi1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
alarm:Tdatetime;
implementation
{$R *.DFM}
uses mmsystem;
procedure TForm1.ontimer(Sender: TObject);
begin
label1.caption:=timetostr(time);
if (time)>=(Alarm) then playsound('c:\windows\media\chimes.wav',0,snd_sync);
end;
procedure TForm1.SetAlarm1Click(Sender: TObject);
begin
Alarm := strtotime(inputbox('input',
'Masukan Alarm-nya',' '));
end;
procedure TForm1.Alarmoff1Click(Sender: TObject);
begin
alarm:=time+1
end;
procedure TForm1.Exit1Click(Sender: TObject);
begin
close;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Alarmoff1Click(sender);
end;
procedure TForm1.Informasi1Click(Sender: TObject);
begin
showmessage('Oleh dazenkilla™');
end;
end.