GetLastInputInfo Function
--------------------------------------------------------------------------------
The GetLastInputInfo function retrieves the time of the last input event.
Syntax
BOOL GetLastInputInfo( PLASTINPUTINFO plii
);
在winuser.h中
#if(_WIN32_WINNT >= 0x0500)
typedef struct tagLASTINPUTINFO {
UINT cbSize;
DWORD dwTime;
} LASTINPUTINFO, * PLASTINPUTINFO;
WINUSERAPI
BOOL
WINAPI
GetLastInputInfo(
OUT PLASTINPUTINFO plii);
#endif /* _WIN32_WINNT >= 0x0500 */
该函数可以探测到系统内鼠标或者键盘的动作,而不是仅限于本App,有全局钩子的味道
其结果 dwTime 可以通过和 GetTickCount()函数的结果比较,得到用户无操作的时间