如果用户未与应用程序交互超过30秒,如何关闭应用程序 [英] how to close the application if the user is not interacting with the application for more than 30sec

查看:62
本文介绍了如果用户未与应用程序交互超过30秒,如何关闭应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,



在我的Windows应用程序中,我希望实现功能,例如当用户未与应用程序交互超过30秒时,我想关闭默认申请

我们可以用定时器控制吗?或任何其他方式?

请给出一些解决方案。





谢谢

ginnas

解决方案

按照答案 - 如何判断Windows何时处于非活动状态 [ ^ ]。



详细文章 - 如何在C#中使用和不使用平台调用来检查用户是否处于不活动状态[ ^ ]。


使用鼠标移动事件进行监视。如果鼠标在分配的时间段内没有移动,请关闭应用程序。

这可能会使您的应用程序速度变慢,因为鼠标每次移动都会计算时差。

Hello,

In my windows application i wanted to implement the functionality like when the user is not interacting with the application for more than 30 sec i wanted to close the application by default
can we do it with timer control? or any other way?
Please give some solution.


Thanks
ginnas

解决方案

Follow the answer - How to tell when Windows is inactive[^].

Detailed article - How to check for user inactivity with and without platform invokes in C#[^].


Monitor using the mouse move event. If the mouse does not move for the alloted time period, close the application.
This could slow down your application to an extent as on every move of the mouse, time difference will be calculated.


这篇关于如果用户未与应用程序交互超过30秒,如何关闭应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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