📄 unit1.~pas
字号:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs,Inifiles, StdCtrls, ADODB, DB, Mask, DBCtrls, ExtCtrls,MMSystem,
Grids, DBGrids, Buttons,Winprocs, ComCtrls;
type
TForm1 = class(TForm)
Timer1: TTimer;
DataSource1: TDataSource;
ADOTable1: TADOTable;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
GroupBox1: TGroupBox;
BitBtn4: TBitBtn;
BitBtn3: TBitBtn;
BitBtn5: TBitBtn;
BitBtn2: TBitBtn;
BitBtn1: TBitBtn;
Label1: TLabel;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
CheckBox3: TCheckBox;
CheckBox4: TCheckBox;
CheckBox5: TCheckBox;
CheckBox6: TCheckBox;
CheckBox7: TCheckBox;
GroupBox2: TGroupBox;
Label2: TLabel;
DBGrid1: TDBGrid;
Label3: TLabel;
Label4: TLabel;
Timer3: TTimer;
ADOQuery1: TADOQuery;
Edit10: TEdit;
UpDown1: TUpDown;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
ADOTable1DSDesigner: TWideStringField;
ADOTable1DSDesigner2: TWideStringField;
DBEdit1: TDBEdit;
DBEdit2: TDBEdit;
ADOTable1DSDesigner3: TWideStringField;
DBEdit3: TDBEdit;
Timer2: TTimer;
Label8: TLabel;
Label9: TLabel;
Timer4: TTimer;
Label10: TLabel;
Edit8: TEdit;
procedure Timer1Timer(Sender: TObject);
procedure BitBtn1Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
procedure BitBtn4Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure BitBtn5Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure CheckBox3Click(Sender: TObject);
procedure CheckBox4Click(Sender: TObject);
procedure CheckBox5Click(Sender: TObject);
procedure CheckBox6Click(Sender: TObject);
procedure CheckBox7Click(Sender: TObject);
procedure DBEdit1KeyPress(Sender: TObject; var Key: Char);
procedure Timer3Timer(Sender: TObject);
procedure UpDown1MouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure UpDown1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure DBEdit3KeyPress(Sender: TObject; var Key: Char);
procedure Timer2Timer(Sender: TObject);
procedure UpDown1Changing(Sender: TObject; var AllowChange: Boolean);
procedure Timer4Timer(Sender: TObject);
procedure DBEdit2KeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
public
Fcount:integer;
{ Public declarations }
mInifile:Tinifile;
end;
var
Form1: TForm1;
HWndITLogin:HWnd;
implementation
{$R *.dfm}
procedure TForm1.Timer1Timer(Sender: TObject);
var
mHour, mMin, mSec, mMSec: Word ;
datetime:Tdatetime ;
DateDay:Tdate;
str,day,tm,H,M,S,Hou,Min,Sec:string;
begin
DateDay:=date;
Day:=IntTostr(DayofWeek((dateDay)-1));
datetime:=time();
decodetime(datetime,mHour,mMin,mSec,mMSec);
H:=floattostr(mHour);
M:=floattostr(mMin);
S:=floattostr(mSec);
if length(H)=2 then
Hou:=H
else
Hou:='0'+H;
if length(M)=2 then
Min:=M
else
Min:='0'+M;
if length(S)=2 then
Sec:=S
else
Sec:='0'+S;
tm:=Hou+Min+Sec;
//Edit8.Text:=Hou+':'+Min+':'+Sec;
//Edit8.Text:=tm;
if day=trim(Edit1.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 小时,分钟,秒钟 from TimeSys');
adoquery1.Open;
adoquery1.First ;
while not adoquery1.Eof do
begin
if (trim(adoquery1.fieldbyname('小时').ASstring)=trim(Hou)) and (trim(adoquery1.fieldbyname('分钟').ASstring)=trim(Min)) then
begin
if (StrToInt(sec)-1<=StrToInt(adoquery1.fieldbyname('秒钟').ASstring)) and (StrToInt(adoquery1.fieldbyname('秒钟').ASstring)<=StrToInt(sec)+1) then
begin
Edit8.Text:=adoquery1.fieldbyname('小时').ASstring+':'+adoquery1.fieldbyname('分钟').ASstring+':'+adoquery1.fieldbyname('秒钟').ASstring;
if (StrToInt(tm)>000000) and (StrToInt(tm)<100000) then
begin
SndPlaySound('saks01.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>100000) and (StrToInt(tm)<150000) then
begin
SndPlaySound('saks02.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>150000) and (StrToInt(tm)<240000) then
begin
SndPlaySound('saks03.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
end;
end;
adoquery1.Next;
end;
end;
if day=trim(Edit2.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 小时,分钟,秒钟 from TimeSys');
adoquery1.Open;
adoquery1.First ;
while not adoquery1.Eof do
begin
if (trim(adoquery1.fieldbyname('小时').ASstring)=trim(Hou)) and (trim(adoquery1.fieldbyname('分钟').ASstring)=trim(Min)) then
begin
if (StrToInt(sec)-1<=StrToInt(adoquery1.fieldbyname('秒钟').ASstring)) and (StrToInt(adoquery1.fieldbyname('秒钟').ASstring)<=StrToInt(sec)+1) then
begin
Edit8.Text:=adoquery1.fieldbyname('小时').ASstring+':'+adoquery1.fieldbyname('分钟').ASstring+':'+adoquery1.fieldbyname('秒钟').ASstring;
if (StrToInt(tm)>000000) and (StrToInt(tm)<100000) then
begin
SndPlaySound('saks01.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>100000) and (StrToInt(tm)<150000) then
begin
SndPlaySound('saks02.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>150000) and (StrToInt(tm)<240000) then
begin
SndPlaySound('saks03.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
end;
end;
adoquery1.Next;
end;
end;
if day=trim(Edit3.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 小时,分钟,秒钟 from TimeSys');
adoquery1.Open;
adoquery1.First ;
while not adoquery1.Eof do
begin
if (trim(adoquery1.fieldbyname('小时').ASstring)=trim(Hou)) and (trim(adoquery1.fieldbyname('分钟').ASstring)=trim(Min)) and (trim(adoquery1.fieldbyname('秒钟').ASstring)=trim(Sec)) then
begin
if (StrToInt(sec)-1<=StrToInt(adoquery1.fieldbyname('秒钟').ASstring)) and (StrToInt(adoquery1.fieldbyname('秒钟').ASstring)<=StrToInt(sec)+1) then
begin
Edit8.Text:=adoquery1.fieldbyname('小时').ASstring+':'+adoquery1.fieldbyname('分钟').ASstring+':'+adoquery1.fieldbyname('秒钟').ASstring;
if (StrToInt(tm)>000000) and (StrToInt(tm)<100000) then
begin
SndPlaySound('saks01.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>100000) and (StrToInt(tm)<150000) then
begin
SndPlaySound('saks02.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>150000) and (StrToInt(tm)<240000) then
begin
SndPlaySound('saks03.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
end;
end;
adoquery1.Next;
end;
end;
if day=trim(Edit4.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 小时,分钟,秒钟 from TimeSys');
adoquery1.Open;
adoquery1.First ;
while not adoquery1.Eof do
begin
if (trim(adoquery1.fieldbyname('小时').ASstring)=trim(Hou)) and (trim(adoquery1.fieldbyname('分钟').ASstring)=trim(Min)) then
begin
if (StrToInt(sec)-1<=StrToInt(adoquery1.fieldbyname('秒钟').ASstring)) and (StrToInt(adoquery1.fieldbyname('秒钟').ASstring)<=StrToInt(sec)+1) then
begin
Edit8.Text:=adoquery1.fieldbyname('小时').ASstring+':'+adoquery1.fieldbyname('分钟').ASstring+':'+adoquery1.fieldbyname('秒钟').ASstring;
if (StrToInt(tm)>000000) and (StrToInt(tm)<100000) then
begin
SndPlaySound('saks01.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>100000) and (StrToInt(tm)<150000) then
begin
SndPlaySound('saks02.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>150000) and (StrToInt(tm)<240000) then
begin
SndPlaySound('saks03.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
end;
end;
adoquery1.Next;
end;
end;
if day=trim(Edit5.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 小时,分钟,秒钟 from TimeSys');
adoquery1.Open;
adoquery1.First ;
while not adoquery1.Eof do
begin
if (trim(adoquery1.fieldbyname('小时').ASstring)=trim(Hou)) and (trim(adoquery1.fieldbyname('分钟').ASstring)=trim(Min)) then
begin
if (StrToInt(sec)-1<=StrToInt(adoquery1.fieldbyname('秒钟').ASstring)) and (StrToInt(adoquery1.fieldbyname('秒钟').ASstring)<=StrToInt(sec)+1) then
begin
Edit8.Text:=adoquery1.fieldbyname('小时').ASstring+':'+adoquery1.fieldbyname('分钟').ASstring+':'+adoquery1.fieldbyname('秒钟').ASstring;
if (StrToInt(tm)>000000) and (StrToInt(tm)<100000) then
begin
SndPlaySound('saks01.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>100000) and (StrToInt(tm)<150000) then
begin
SndPlaySound('saks02.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
if (StrToInt(tm)>150000) and (StrToInt(tm)<240000) then
begin
SndPlaySound('saks03.wav',SND_ASYNC);
Timer3.Enabled:=true;
end;
end;
end;
adoquery1.Next;
end;
end;
if day=trim(Edit6.Text) then
begin
adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select 小时,分钟,秒钟 from TimeSys');
adoquery1.Open;
adoquery1.First ;
while not adoquery1.Eof do
begin
if (trim(adoquery1.fieldbyname('小时').ASstring)=trim(Hou)) and (trim(adoquery1.fieldbyname('分钟').ASstring)=trim(Min)) then
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -