如何显示时间到期和从Windows应用程序注销? [英] How to show time expiry and logout from windows application ?

查看:78
本文介绍了如何显示时间到期和从Windows应用程序注销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

如何捕获空闲时间并显示退出消息?例如如果系统空闲20分钟,则需要显示logg msg并退出Windows应用程序。如果用户活动在20分钟之前发生,则再次重置计时器。













问候

Aravind

Hi all
How to capture the idle time and show log out msg? e.g. If the system is idle for 20mins., then it needs to show log out msg and exit from windows application. If user activity occurs prior to 20mins., then reset timer again.






Regards
Aravind

推荐答案

如何使用计时器:



http://msdn.microsoft.com/en-us/library/system.windows.forms.timer(v = VS.100)的.aspx



*使用开始方法开始计时。

*使用停止然后开始重新启动计时器。

*处理 Tick 事件以了解您的时间何时到期。



如何退出申请表:



http://msdn.microsoft.com/en-us/library/ms157894(v = VS.100)的.aspx
How to use a Timer:

http://msdn.microsoft.com/en-us/library/system.windows.forms.timer(v=vs.100).aspx

* Use the Start method to start the time ticking.
* Use Stop then Start to restart the timer.
* Handle the Tick event to know when your time is expired.

How to exit an application:

http://msdn.microsoft.com/en-us/library/ms157894(v=vs.100).aspx


这可能就是你要找的东西。我有一个用于查看器的修改版本,当用户打开文档时锁定文档,如果查看器没有检测到任何活动,则会释放锁并关闭文档。它工作得非常好。

检测应用程序空闲状态 [ ^ ]
This may be what you are looking for. I have a modified version for a viewer that locks a document while the user has it open and if the viewer detects no activity it releases the lock and closes the document. It has worked very well.
Detecting Application Idleness[^]


这篇关于如何显示时间到期和从Windows应用程序注销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆