对mousemove事件采取行动 [英] action on mousemove event
问题描述
好的,感谢venna我现在有一个计时器在我的登录表格上工作,当我转到另一个表格时,计数器仍然响了。
现在我''我一直在研究一种检测鼠标何时移动的方法,以便我可以设置一个值,比如移动时的1,然后计时器达到60x5(5分钟),它将值设置为1然后如果它们''然后两个人然后注销/卸载/关闭数据库等。
这就是我得到的:
a在那儿吗?我安静地来了:)
那里有人吗?我安静地来了:)
你能采取另一种方法吗?例如,因为你正在进行API调用来检查光标位置,我想它实际上并不依赖于任何特定的控件,甚至你的表单。那么,如果你有一个计时器来检查它...哦,每秒说十次,只是在它改变时设置一个标志?
如果这是你想要做的:如果你的应用程序正在运行但是闲置几分钟,那么你想出来..
然后这样做:
保留项目级变量(添加.Bas模块)并声明这个
Public MyCount As Integer
并且在所有表格的MouseMove事件和KeyPress事件中给出:
MyCount = 0
In主要表格''Timer1_Timer事件:
MyCount = MyCount + 1
如果MyCount> = 300那么
结束
结束如果
对不起,如果我没有正确理解。
问候
Veena
Ok thanks to venna I now have a timer working on my login form which when I go to another form the counter still ticks over.
Now I''ve been working on a way of detecting when the mouse has been moved so that I can set a value, say to 1 when it is moved and then the timer gets to 60x5 (5 mins) it sets a value to 1 and then if they''re both one then log off / unload / close db etc.
Here''s what I got:
anyone out there ? i come in peace :)
anyone out there ? i come in peace :)Is there another approach you could take? For instance, since you''re doing an API call to check the cursor position, I guess it really isn''t dependent on any particular control, or even your form. So what if you had a timer which checks it... oh, say ten times a second, and just sets a flag when it changes or something?
Hi,
If this is what you want to do : If your Application is running but Idle for few mins, then you want to come out..
Then do this :
Keep a project-level variable (add a .Bas module ) and declare this
Public MyCount As Integer
And in MouseMove event and KeyPress event of all the Forms give :
MyCount = 0
In Main form''s Timer1_Timer Event:
MyCount = MyCount + 1
If MyCount >= 300 Then
End
End If
Sorry if I have not understood properly.
Regards
Veena
这篇关于对mousemove事件采取行动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!