Windows 函数"GetCursorInfo"返回成功,但光标的句柄为 NULL
Windows function "GetCursorInfo" returns success but the HANDLE to the cursor is NULL
我正在尝试获取全局光标的句柄。因此,我使用Windows函数"GetCursorInfo"。函数的返回值为非零值,这意味着它成功了。但是,返回的游标的句柄为 NULL。
这是我正在使用的代码:
CURSORINFO ci;
ci.cbSize = sizeof(ci);
if (!GetCursorInfo(&ci)) {
cout << "GetCursorInfo() failed" << endl;
return 1;
}
cout << ci.hCursor << endl; // ci.hCursor is 0x00000000
我只在装有 Windows 10 的英特尔 NUC 迷你电脑上收到此错误(而不是在装有 Windows 10 的普通 PC 上(。
我在其他任何地方都找不到此错误,因此将不胜感激!
谢谢!
好的,我已经弄清楚为什么会发生这种情况:
我正在远程连接到我的英特尔 NUC 迷你电脑,因此没有连接物理鼠标。这似乎是导致问题的原因。一旦我连接物理鼠标,一切就会再次按预期工作。
一旦没有连接鼠标,Windows 似乎就会切换到平板电脑模式,因此隐藏光标。
相关文章:
- 外壳包装器句柄/执行交互式命令管道C++ UNIX
- 如何获取边缘窗口句柄 (HWND)?
- 枚举进程模块在有效句柄上返回无效句柄
- 在 c/c++ 中打开 PhysicalDrive 的句柄并写入 MBR 的 linux 等效是什么?
- 从运行服务的应用程序代码中提取窗口句柄
- 在读取文件后重置句柄
- 是否有像地图这样的C++结构,但我得到的不是值的键,而是值的句柄?
- Microsoft ODBC 无法创建有效的句柄
- 我是否可以使用 win32 句柄以编程方式记录发送到/接收到 USB/COM 的内容
- 获取特定进程的句柄数
- C++ 创建 NdisProt 驱动程序的句柄
- 是否需要关闭来自 WinHTTP 异步的句柄?
- 句柄OK全部崩溃
- 我需要通过窗口句柄(HWND)获取文件,我该怎么办?
- 什么是 C# 等同于C++句柄
- 未知C++错误:致命错误:glibc检测到无效的stdio句柄
- 获取现有进程句柄
- GetModuleHandle() 无法检索由 "notepad.exe" 加载的"advapi32.dll"的句柄
- Windows 函数"GetCursorInfo"返回成功,但光标的句柄为 NULL
- 获取光标下窗口的窗口句柄