delphi定时
来源:互联网 发布:python math包 编辑:程序博客网 时间:2024/05/16 08:05
procedure TForm1.Button1Click(Sender: TObject);begin timer1.Interval:=60*1000; //启动监控,每1分钟检查一次设定时间和当前时间 timer1.Enabled:=true;end;procedure TForm1.Timer1Timer(Sender: TObject);var l_time: TDateTime; h_time: TDateTime; ss:Int64;begin timer1.enabled:=false; h_time:= strtotime('10:30:00'); l_Time := time; //now是取当前的日期加时间,time只取当前时间 if (h_time>l_time) then begin ss:=SecondsBetween(h_time,l_time); //求两个时间相差多少秒 if ss<5*60 then begin //如果时间间隔小于5分钟定时启动timer2 timer1.Enabled:=false; showmessage('Inteval seconds:'+inttostr(ss)); timer2.Interval:=ss*1000; timer2.Enabled:=true; end; end else timer1.enabled:=true; end;procedure TForm1.Timer2Timer(Sender: TObject);begin timer2.enable:=false; showmessage('ok on time run the program'); timer1.Enabled:=true; //再次开始监控end;自己加入要执行程序的代码...或者用Timer2替掉也行实现
使用delphi2009手动设置多个时间段,定时执行扫描文件任务,不知道用哪种方法,定时器控件好像不是很好,为此定时成天纠结,请各位知道的不吝赐教,俺么感激不尽。。。。。最好有具体的代码,不然不能深入了解。。。。详细阐述下多线程的方案吧DELPHI里的定时器精度很差,一分钟一次还行,时间长了就不行了。1\最好是用线程实现,线程中加上sleep(毫秒)2\用定时器,查到任务后开线程
0 0
- delphi定时
- Delphi定时Showmessage事件
- delphi非timer定时
- delphi邮件定时发送
- Delphi定时关闭各种对话框
- delphi 多线程定时执行程序如何写
- Delphi实现通用的定时自动关机程序
- Delphi实现通用的定时自动关机程序
- Delphi中三种延时方法及其定时精度分析
- Delphi中三种延时方法及其定时精度分析
- Delphi中三种延时方法及其定时精度分析
- Delphi中三种延时方法及其定时精度分析
- DELPHI 创建自己的定时器 定时清理内存
- 定时
- 定时
- 定时
- delphi+飞信API接口实现定时发送数据提醒短信
- DElphi
- SnackBar 笔记(三)错误及问题
- 乐学成语
- C++ 11 中的右值引用
- 剑指offer(14)-树的子结构
- oracle 查询近几天数据
- delphi定时
- 选择排序-堆排序
- Android性能优化典范(五)
- [Android] Handler 用法总结
- EJB是什么
- 笔记︱精准营销解决方案以及营销组合评估
- 使用FT232RL 替代PL2303 注意
- 插入排序-直接插入排序
- 算法--查找--二分查找