我想设置一个定时器,每阁一个小时就响应一次打印机打印事件,大侠们教教我吧,菜鸟!
解决方案 »
- 编译DLL的问题?
- 如何动态添加子菜单?
- ***********怎样写代码使大的JPG图片文件,象ACDSEE的Fit image功能一样显示一个完整而不失真的效果!****
- delphi5的一个小问题,toolbar上的SEPARATOR的隐藏问题
- 一起谈模式,ok?
- 急,Peekmessage和Getmessage联合起来用。
- delphi xe6 如何在安卓手机创建文件夹?
- ◆◆◆◆◆◆help:adotable经过滤以后,再用locate('bh'...)发现如果原未过滤时表中无的bh,可以报未找到,如是有的但被过滤的编号,locate会找到其下一个最近编号,并不报未找到?◆◆◆◆◆◆
- 大富翁怎么死活进不去了?
- 我不喜欢数据库编程,学点什么号呢?
- 怎样关闭rar进程?
- ASTA问题!!
procedure TNPForm.TimerTimer(Sender: TObject);
beginend;可我查了很多程序,知道中间有个Interval,可它是控制毫秒级的,最大也只有64秒多,怎么办?
用循环来控制,timer1到了把其enable 置为false,同时timer2开启,如此,直到timer60开启时
执行你的打印,打印完毕后开启又timer1.
这是可行的,你试试吧。
你可以在timer的ontime事件中调用now()函数,然后记住上一次响应时间,然后与现在世界求diff到一个小时后就调用打印机事件啊!
Unit
Windows.PasSyntax
GetTickCount: DWORD; {returns a 32 bit number}
//函数
Description
This function returns the number of milliseconds that have elapsed since Windows was started. Since this time is stored in a DWORD, it will wrap to zero if Windows is left in operation for 49.7 days. Under Windows NT, the application can obtain the elapsed time since Windows was started by finding the System Up Time counter in performance data under the HKEY_PERFORMANCE_DATA registry key. This value will be an 8 byte number.Return Values
If the function succeeds, the return value is the number of milliseconds that have elapsed since Windows was started; otherwise it returns zero.
for example:
procedure TForm1.Button1Click(Sender: TObject);
var
Tick: DWORD; // holds the number of milliseconds
begin
{get the number of milliseconds since Windows was started}
Tick:= GetTickCount; {display the number of milliseconds}
Label1.Caption:= 'Number of Milliseconds: ' + IntToStr(Tick);
end;你可以写一个线程,在线程中计数判断是否过了一个小时,若符合条件则执行打印过程,执行完后重起线程就行了。