我想知道从用户输入当前的空闲时间给定的Windows XP计算机上编程。 我在MS Access使用VBA。 我有什么选择?
Answer 1:
我用下面以获得溶液。
Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Declare Function GetLastInputInfo Lib "user32" (plii As Any) As Long
Private Type LastInputInformation
cbSize As Long
dwTime As Long
End Type
Public Function GetUsersIdleTime() As Long
Dim lii As LastInputInformation
lii.cbSize = Len(lii)
Call GetLastInputInfo(lii)
GetUsersIdleTime = FormatNumber((GetTickCount() - lii.dwTime) / 1000, 2)
End Function
有该系统可以是空闲如的其他部分,
- 中央处理器
- 磁盘
- 网络
- 其他设备
要了解更多关于性能和其他类型的闲置看到这个SO张贴在这里 。
文章来源: How to get the idle time in Windows XP using VBA?