我正在使用 InputSimulator 来模拟按键和鼠标点击。到目前为止,我测试过的每个键都可以使用,但鼠标按钮除外。我这样发送它们:
private void button2_Click(object sender, EventArgs e) //In this example I am trying to simulate the left mouse button
{
System.Threading.Thread.Sleep(2000);
InputSimulator.SimulateKeyPress(VirtualKeyCode.LBUTTON);
}
但是没有任何反应。我做错了什么吗?
图书馆:InputSimulator
最佳答案
最新版本的 InputSimulator 支持鼠标事件。下面是如何使用它:
var sim = new InputSimulator();
sim.Mouse.LeftButtonClick();
请注意,二进制下载已过时,因此您必须从源代码构建库。
关于c# - InputSimulator 不模拟鼠标点击,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18920235/