Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想检测空闲时间(例如,用户按下键或移动鼠标多长时间)。假设 GetLastInputInfo() 应该是我需要的,但是当我使用它时,它总是打印 0。
LASTINPUTINFO last_input = {0}; GetLastInputInfo(&last_input); cout << last_input.dwTime << endl;
知道为什么吗?
谢谢
编辑:使用 getlasterror,它说参数不正确(ERROR_INVALID_PARAMETER,87)
解决了!忘记初始化 cbSize ...