以前Delphi6写的一个程序,你再调调。
unit frmMain_Unit;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,MMSystem;type
TfrmMain = class(TForm)
lTimer: TLabel;
Timer: TTimer;
procedure TimerTimer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function GetCurTime(CurSecond: integer): string;
procedure TestPlaySound;
public
{ Public declarations }
end;var
frmMain: TfrmMain;
CurSecond: integer;
hh, mm, ss: Integer;implementation{$R *.dfm}function TFrmMain.GetCurTime(CurSecond: integer): string;
var
m, s: string;
begin
mm := CurSecond div 60;
if mm < 10 then
m := '0' + inttostr(mm)
else
m := inttostr(mm);
ss := CurSecond mod 60;
if ss < 10 then
s := '0' + inttostr(ss)
else
s := inttostr(ss);
Result := m + ':' + s;
end;procedure TFrmMain.TestPlaySound;
var
Path : String;
begin
Path := ExtractFilePath(ParamStr(0))+'Test.mp3';
PlaySound(pchar(Path),0,snd_nodefault);
end;procedure TfrmMain.TimerTimer(Sender: TObject);
begin
lTimer.Caption := GetCurTime(CurSecond);
dec(CurSecond);
if lTimer.Caption='01:00' then
TestPlaySound;
if lTimer.Caption='00:00' then
begin
Timer.Enabled:=false;
lTimer.Font.Color:=clRed;
end;
end;procedure TfrmMain.FormCreate(Sender: TObject);
begin
CurSecond:=12*60;
lTimer.Caption := GetCurTime(CurSecond);
Timer.Enabled:=true;
end;end.
unit frmMain_Unit;interfaceuses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls,MMSystem;type
TfrmMain = class(TForm)
lTimer: TLabel;
Timer: TTimer;
procedure TimerTimer(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
function GetCurTime(CurSecond: integer): string;
procedure TestPlaySound;
public
{ Public declarations }
end;var
frmMain: TfrmMain;
CurSecond: integer;
hh, mm, ss: Integer;implementation{$R *.dfm}function TFrmMain.GetCurTime(CurSecond: integer): string;
var
m, s: string;
begin
mm := CurSecond div 60;
if mm < 10 then
m := '0' + inttostr(mm)
else
m := inttostr(mm);
ss := CurSecond mod 60;
if ss < 10 then
s := '0' + inttostr(ss)
else
s := inttostr(ss);
Result := m + ':' + s;
end;procedure TFrmMain.TestPlaySound;
var
Path : String;
begin
Path := ExtractFilePath(ParamStr(0))+'Test.mp3';
PlaySound(pchar(Path),0,snd_nodefault);
end;procedure TfrmMain.TimerTimer(Sender: TObject);
begin
lTimer.Caption := GetCurTime(CurSecond);
dec(CurSecond);
if lTimer.Caption='01:00' then
TestPlaySound;
if lTimer.Caption='00:00' then
begin
Timer.Enabled:=false;
lTimer.Font.Color:=clRed;
end;
end;procedure TfrmMain.FormCreate(Sender: TObject);
begin
CurSecond:=12*60;
lTimer.Caption := GetCurTime(CurSecond);
Timer.Enabled:=true;
end;end.
解决方案 »
- 关于函数调用的小问题!
- 如何获得当前插入记录的唯一ID编号?
- 怎么在程序中签名?
- 据说Delphi7以后的版本都要基于.NET,那么如果我已经装了.NET Framework,Delphi2005或Delphi2006是用的哪个版本的Framework?
- treeview问题:原先我已经动态加载了节点,我又该如何清空treeview中的所有节点
- 大家来指点一下,我想开发一个c/s软件
- 各位虾们,本人准备开发一个人力资源系统,上哪可找到已开发成功的人力资源管理系统?本人只要稍加修改即可
- 用wise打包安装后开始菜单中没有程序,怎样设置才能出现??
- Delphi7里sampl中的TGauge(看起来像做进度条的)怎么用的?
- 函数返回值问题,帮我看看谢谢
- 能做一个启动和结束程序的程序不?
- 春节福利贴
1、1小时=3600秒
2、用计时器-1即可
3、要显示就把剩余秒数再转换成时分秒的格式就可以了。