linkedin facebook linkedin facebook nod32

Delphi da budilnikni yaratish usuli

Muallif: Mengliyev Sh.

Qo`shilgan sana: 2014-05-27

Delphi dasturlash tilida budilnikni yaratish usuli


Quyida budilnik delphi da yaratib olingan

Dastur kodi

unit Alarm2_;

interface

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

ShellAPI, // Shell_NotifyIcon uchun dostup
DateUtils;

type
TForm1 = class(TForm)
Timer1: TTimer;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
UpDown1: TUpDown;
Label5: TLabel;
UpDown2: TUpDown;
Shape1: TShape;
Label7: TLabel;
Button1: TButton;
Shape2: TShape;
Label8: TLabel;
Edit1: TEdit;
Label6: TLabel;
Label9: TLabel;

procedure FormCreate(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure UpDown1Click(Sender: TObject; Button: TUDBtnType);
procedure UpDown2Click(Sender: TObject; Button: TUDBtnType);
procedure Button1Click(Sender: TObject);

private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

uses Unit2;

{$R *.dfm}

var
Hour,Min: word; // indikaror uchun vaqt
AlHour, AlMin: word; // budilnikni o`rnatish AlHour:AlMin

// Dastur ishga tushish
procedure TForm1.FormCreate(Sender: TObject);
begin
Hour := HourOf(Now);
Min := MinuteOf(Now);
Label1.Caption := IntToStr(Hour);
if Min < 10
then Label2.Caption := '0'+IntToStr(Min)
else Label2.Caption := IntToStr(Min);
end;

// vaqt bo'yicha signal
procedure TForm1.Timer1Timer(Sender: TObject);
var
cHour,cMin: word;
begin
// получить текущее время
cHour := HourOf(Now);
cMin := MinuteOf(Now);

if Timer1.Tag = 0
then begin
if cHour <> Hour then
begin
Hour := cHour;
Label1.Caption := IntToStr(Hour);
end;

if cMin <> Min then
begin
Min := cMin;
if min <10
then Label2.Caption := '0' + IntToStr(Min)
else Label2.Caption := IntToStr(Min);
end;

if Label3.Visible
then Label3.Visible := False
else label3.Visible := True;
end

else if (cHour = AlHour) and (cMin = AlMin)
// сигнал !
then begin
Form2.Show;
Timer1.Tag := 0;
Timer1.Interval := 1000;
end;
end;

// budilnik qo'yilgan vaqt bo`yicha signali
procedure TForm1.UpDown1Click(Sender: TObject; Button: TUDBtnType);
begin
if UpDown1.Position < 10
then Label4.Caption := '0' + IntToStr(UpDown1.Position)
else Label4.Caption := IntToStr(UpDown1.Position);
end;

procedure TForm1.UpDown2Click(Sender: TObject; Button: TUDBtnType);
begin
if UpDown2.Position < 10
then Label5.Caption := '0' + IntToStr(UpDown2.Position)
else Label5.Caption := IntToStr(UpDown2.Position);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin

AlHour := UpDown1.Position;
AlMin := UpDown2.Position;
Timer1.Tag := 1;
Form1.Hide;
Timer1.Interval := 3000; // har 3 sekunda tekshirish
end;

end.

2136 marta o`qildi.

Parol:
Eslab qolish.


Ro`yhatdan o`tish

testing

+998915878681

Siz o`z maxsulotingizni 3D reklama ko`rinishda bo`lishini xohlaysizmi? Unda xamkorlik qilamiz.

3D Reklama


Рейтинг@Mail.ru
Рейтинг@Mail.ru

Besucherzahler
счетчик посещений