DELPHI时间触发事件!

 1  procedure  TForm1.Timer2Timer(Sender: TObject);   
 2  // delphi 时间触发事件   
 3  var   
 4    S,D:TDateTime;   
 5    ActiveHH: string ; // 触发小时   
 6    ActiveMM: string ; // 触发分   
 7    ActiveSS: string ; // 触发秒   
 8  begin   
 9    s: = strtodatetime(FormatDateTime( ' hh:mm:ss ' ,Now)); // 时间   
10    
11    ActiveHH : = Edit3.Text; // 时   
12    ActiveMM : = Edit4.Text; // 分   
13    ActiveSS : = Edit5.Text;  // 秒   
14    
15    
16    D: = strtodatetime(ActiveHH  + ' : '   +  ActiveMM  +   ' : '   +  ActiveSS);  // 到时间    
17    
18     // 当日期为当天就触发   
19     if   FormatDateTime( ' YYYY-MM-DD  ' ,DateTimePicker2.date)  =  FormatDateTime( ' YYYY-MM-DD  ' ,now)  then   
20     begin   
21       if  s = then   // 当时间一样就触发   
22       begin   
23        showmessage( ' 电脑爆了! ' );   
24         //  这中间你加入你自己要 执行的数据库语句   
25       end ;   
26     end ;   
27    
28  end ;   

 

转载于:https://www.cnblogs.com/rogee/archive/2010/09/14/1827244.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值