如何通过windows api获取最后一个windows活动时间 [英] How to get the last windows active time by windows api

查看:26
本文介绍了如何通过windows api获取最后一个windows活动时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一般来说,当我们在一段时间内什么都不做时,屏幕保护程序就会运行.
现在我想知道如何获得非活动时间.
换句话说,我想做一个程序,如果我们在一段时间内什么都不做,它就会运行一个函数.
现在我可以使用鼠标或键盘挂钩来解决问题了.
但是你知道,它需要管理员权限.换句话说,如果在win vista或win 7中,因为UAC是令人作呕的.
我需要一个 API 来获取上次 Windows 活动时间.

In general, the Screensaver will run when we do nothing for a period of time.
Now i wanna know how to get the unactive time.
In another word,i want to make a program which would run a function if we do nothing for a period of time.
Now i can use mouse or keyboard hook to solve the problem.
But you know,it needs administrator permissions. In another word,if in win vista or win 7,it is nauseating because of the UAC.
I need an API such to get last windows active time.

推荐答案

CallNtPowerInformation() API 是获取最后的电量信息
我应该使用 GetLastInputInfo()

The CallNtPowerInformation() API is to get the last power information
I should use GetLastInputInfo()

这篇关于如何通过windows api获取最后一个windows活动时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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