gpt4 book ai didi

c++ - GetLastInputInfo() 始终为 0(零)

转载 作者:可可西里 更新时间:2023-11-01 10:06:56 24 4
gpt4 key购买 nike

我想检测空闲时间(例如,用户按下某个键或移动鼠标的时间有多长)。据说 GetLastInputInfo() 应该是我需要的,但是当我使用它时,它总是打印 0。

LASTINPUTINFO   last_input  =   {0};
GetLastInputInfo(&last_input);
cout << last_input.dwTime << endl;

知道为什么吗?

谢谢

编辑:使用 getlasterror,它表示参数不正确(ERROR_INVALID_PARAMETER,87)

最佳答案

解决了!忘记初始化 cbSize ...

关于c++ - GetLastInputInfo() 始终为 0(零),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16760240/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com