在研究了如何通过模拟键盘来控制其他应用程序之后,很多人建议我使用“inputsimulator” CodePlex
我解压缩文件夹并在我的 C# 项目中查找要引用的 .dll 文件,但找不到 inputsimulator.dll 文件。
这是我到目前为止所拥有的:
using System;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using WindowsInput;
public class WindowHandling
{
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
private static extern bool SetForegroundWindow(IntPtr hWnd);
static void Main()
{
InputSimulator.SimulateKeyDown(VirtualKeyCode.SHIFT);
}
}
这是错误消息:
'InputSimulator' does not contain a definition for 'SimulateKeyDown'
The name 'VirtualKeyCode' does not exist in the current context
如何参考InputSimulator
?