在 VMware 中移动光标

Move cursor within VMware

好的,所以我已经为此绞尽脑汁一段时间了,我需要一些帮助。我有一个我构建的小型 C# 应用程序,我想移动光标。下面是 "should" 移动光标的以下代码片段:

Console.WriteLine("x::"+Cursor.Position.X+" y::"+Cursor.Position.Y);
Cursor.Position = new Point(Cursor.Position.X - 50, Cursor.Position.Y - 50);
Console.Read();

让我发疯的是,这在我的主机 Windows 7 机器上有效,但在我的 Windows 7 我的 VMWare 客户机上无效。

还有其他人遇到过这个问题吗?我已经搜索了互联网,但一直找不到任何东西。

感谢您的宝贵时间!

考虑使用 InputSimulator:

The Windows Input Simulator provides a simple .NET (C#) interface to simulate Keyboard or Mouse input using the Win32 SendInput method. All of the Interop is done for you and there's a simple programming model for sending multiple keystrokes.

您需要在应用程序中引用它,然后将其与已编译的可执行文件一起复制到来宾计算机。

原来是VMWare工具的问题。我卸载了 VMWare 工具,它工作了。我认为这与虚拟鼠标驱动程序有关,但是当我尝试在没有鼠标驱动程序的情况下重新安装 VMWare Tools 时,它仍然无法正常工作。

我找到的唯一解决方案是完全删除 VMWare Tools。