查找 EXE 窗口是否处于活动状态
当我运行我的 exe 并使其空闲时,我的一个项目有不同的要求 (即没有点击,min,max),一段时间(定时器)后它应该自动关闭。如果有人在特定时间之前单击,则计时器必须重置为同一时间段。 如何判断exe是否空闲?
I have a different requirement in one of my projects, when I run my exe and make it idle
(i.e. without click, min, max), after a period of time (timer) it should be automatically closed. If anyone clicked before the particular time, the timer must reset for the same period.
How can I find out whether the exe is idle or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想查看 < code>Application.Idle 事件(注意:据我所知,仅适用于 WinForms 应用程序)。
如果您将它与一个计时器结合起来,只要您的应用程序收到输入,您就停止/重置计时器,这应该会给您带来您想要的东西。
You might want to take a look at the
Application.Idle
event (Note: Only applicable to a WinForms application, as far as I'm aware).If you combine it with a timer that you stop/reset whenever your application receives input, that should give you pretty much what you're looking for.
公共类 GlobalMouseHandler : IMessageFilter
GlobalMouseHandler 句柄 = new GlobalMouseHandler();
handle.onActive += new GlobalMouseHandler.EventHandlerForActiveState(handle_onActive);
Application.AddMessageFilter(句柄);
我使用了这个类并完成了这个。
public class GlobalMouseHandler : IMessageFilter
GlobalMouseHandler handle = new GlobalMouseHandler();
handle.onActive += new GlobalMouseHandler.EventHandlerForActiveState(handle_onActive);
Application.AddMessageFilter(handle);
I used this class and done this.