📄 yybs.pas
字号:
unit yybs;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,mmsystem,
StdCtrls,LMDTrayIcon, Buttons, Spin, ExtCtrls, LMDControl,inifiles,
LMDBaseControl, LMDBaseGraphicControl, LMDBaseLabel, LMDCustomLabel,
LMDLabel, AHMTCommandLabel, LMDCustomComponent, LMDWndProcComponent
;
type
TForm1 = class(TForm)
Timer1: TTimer;
LMDTrayIcon1: TLMDTrayIcon;
Image1: TImage;
AHMCommandLabel3: TAHMCommandLabel;
AHMCommandLabel2: TAHMCommandLabel;
AHMCommandLabel1: TAHMCommandLabel;
LMDLabel1: TLMDLabel;
Shape1: TShape;
Label1: TLabel;
RadioButton1: TRadioButton;
RadioButton2: TRadioButton;
Label2: TLabel;
SpinEdit1: TSpinEdit;
Label3: TLabel;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
procedure Timer1Timer(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure LMDTrayIcon1Click(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpinEdit1Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
GaiB:string;
Fini:TINIFile;
procedure Baoshi(s:string);
procedure Kaishi();
implementation
{$R *.DFM}
{$R wav.res}
procedure Kaishi();
var shi,fen:string;
i:integer;
begin
shi:=FormatDateTime('hh',time); //时
fen:=FormatDateTime('nn',time); //分
i:=strtoint(shi);
if form1.RadioButton1.checked and (i>12) then //十二小时制
if i-12<10 then shi:='0'+inttostr(i-12) else shi:=inttostr(i-12);
Baoshi(shi);
if shi='00' then PlaySound('w0',hInstance,SND_RESOURCE);
PlaySound('wd',hInstance,SND_RESOURCE);
Baoshi(fen);
PlaySound('wf',hInstance,SND_RESOURCE);
end;
procedure TForm1.Timer1Timer(Sender: TObject);
begin
form1.Caption:='语音报时器 1.0 '+FormatDateTime('hh:nn:ss',time);
if GaiB=FormatDateTime('nn',time) then exit else GaiB:=FormatDateTime('nn',time);
if strtoint(GaiB) mod spinedit1.Value=0 then
kaishi;
end;
procedure Baoshi(s:string);
begin
if s[1]<>'0' then begin
if s[1]>'1' then PlaySound(pchar('w'+copy(s,1,1)),hInstance,SND_RESOURCE);
PlaySound('w10',hInstance,SND_RESOURCE);
end;
if s[2]<>'0' then PlaySound(pchar('w'+copy(s,2,1)),hInstance,SND_RESOURCE);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
LMDTrayIcon1.Free;
Fini.WriteBool('','制度',RadioButton2.Checked);
Fini.WriteInteger('','频率',SpinEdit1.Value);
Fini.Free;
end;
procedure TForm1.LMDTrayIcon1Click(Sender: TObject);
begin
form1.show;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
Kaishi;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
form1.Close;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
form1.Hide;
end;
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
if spinedit1.Text='' then spinedit1.Value:=1;
if spinedit1.Value>60 then spinedit1.Value:=60;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Fini:=TINIFile.Create(ExtractFilePath(Application.Exename)+'\语音报时器.ini');
RadioButton2.Checked:=Fini.ReadBool('','制度',True);
RadioButton1.Checked:=Not RadioButton2.Checked;
SpinEdit1.Value:=Fini.ReadInteger('','频率',60);
GaiB:=FormatDateTime('nn',time);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -