gpt4 book ai didi

c++ - SetCursorPos 和 GetCursorPos 在登录屏幕上不起作用?

转载 作者:太空狗 更新时间:2023-10-29 23:48:14 27 4
gpt4 key购买 nike

当我尝试在 Windows Vista/7 登录屏幕上使用 SetCursorPos 时,返回了 true,这起初让我认为它正在工作。但是,当我调用 GetCursorPos 时,它会给我:

-858993460,-858993460

有什么想法吗?这是“安全功能”还是我使用不当?该代码在非登录(即正常)桌面上运行良好。

最佳答案

来自 the MSDN :

The input desktop must be the current desktop when you call GetCursorPos. Call OpenInputDesktop to determine whether the current desktop is the input desktop. If it is not, call SetThreadDesktop with the HDESK returned by OpenInputDesktop to switch to that desktop.

This page (我从上面引述的地方)询问“如果桌面被锁定,GetCursorPos 不工作”这个问题,包含以下信息:

You can't get this information while the desktop is locked. While the desktop is locked, the security subsystem takes over, and your desktop is off limits.

At that point, you would have to hook into the O/S (people have done it by replacing GINA.dll, but you can't do this in managed code, and on top of that, you can't do it in Vista, as it has a different model).

While the desktop is locked, you are going to have to do without cursor information if you are using managed code.

关于c++ - SetCursorPos 和 GetCursorPos 在登录屏幕上不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1964149/

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