def GetIdleDuration():
class LASTINPUTINFO(Structure):
_fields_ = [
('cbSize', c_uint),
('dwTime', c_uint),
]
lastInputInfo = LASTINPUTINFO()
lastInputInfo.cbSize = sizeof(lastInputInfo)
windll.user32.GetLastInputInfo(byref(lastInputInfo))
millis = windll.kernel32.GetTickCount() - lastInputInfo.dwTime
return millis
调用C++ API获取系统在无操作状态下的时间段
python获取系统空闲时间段
最新推荐文章于 2021-05-03 16:25:09 发布