如何监测正在运行的程序,若是n分钟没任何操操作(100分)

  • 主题发起人 主题发起人 fjqian
  • 开始时间 开始时间
F

fjqian

Unregistered / Unconfirmed
GUEST, unregistred user!
如何监测正在运行的程序,若是n分钟没任何操作就关闭程序或者注销程序。
 
使用Timer/定义一个全局变量。
再窗体的父类中,的Mouse相关事件、键盘事件中变量归零。
Tier事件中判断如果大于某值时,关闭或注销。
 
是个思路,可以一试
 
有没有API函数,或者消息捕捉,如类似于屏幕保护程序捕捉事件
 
有更方便的办法实现
在ApplicationEvents控件中有onidle的事件可以直接响应空闲事件的。
 
Kanny_Chen
能不能关于ApplicationEvents控件中有onidle事件具体举个例子,不胜感激
 
TApplicationEvents和Ttimer结合使用即可
procedure TForm1.ApplicationEvents1Message(var Msg: tagMSG;
var Handled: Boolean);
begin
Timer1.Enabled := False;
end;

procedure TForm1.ApplicationEvents1Idle(Sender: TObject;
var Done: Boolean);
begin
Timer1.Enabled := True;
end;

procedure TForm1.Timer1Timer(Sender: TObject);
begin
form1.Close;
(form1.Parent as Tform).close;
end;
快试试吧
TApplicationEvents在additional组件中
Ttimer设interval为n*60*1000
你也可在ApplicationEvents1Message中再对消息具体进行判断和过滤处理


 
搞定了,多谢Seeyouknowme帮助,同时也感谢Cut.fei,kanny_chen
 
后退
顶部