问题描述
在 Visual Studio 2013 中,我安装了一个名为InputSimulator"的 C# 包.这样做之后,我看到一个名为WindowsInput"的新引用被添加到我的项目中.(即 WindowsInput.dll)
In Visual Studio 2013, I installed a C# package called "InputSimulator." After doing so, I see a new reference get added to my project called "WindowsInput." (i.e., WindowsInput.dll)
问题在于,codeplex 网站谈到的所有方法都无法访问.如果我尝试:
The problem is that none of the methods that the codeplex site talks about are accessible. If I try:
InputSimulator.SimulateTextEntry("Say hello!");
我得到错误:
Error 14 'WindowsInput.InputSimulator' does not contain a definition for
'SimulateTextEntry' Blah.cs 33 32 ALibrary
我确实有 using WindowsInput
作为指令.
I do have using WindowsInput
as a directive.
有谁知道为什么这些方法无法访问?SimulateKeyPress()
等方法也不可用.这些是关键 API.我是否缺少有关添加此库和引用它的内容?
Does anyone know why the methods are not accessible? Methods like SimulateKeyPress()
are also not available. These are the key API. Am I missing something about adding this library and referencing it?
推荐答案
所以我只是尝试了这个lib.实际上,他们的文档只是有点偏离.你需要先创建一个 InputSimulator 的实例,像这样:
So I just tried this lib. Actually their documentation is just a little off. You need to create an instance of InputSimulator first, like this:
InputSimulator s = new InputSimulator();
s.Keyboard.TextEntry("Hello sim !");
这篇关于通过 NuGet 安装 InputSimulator,没有成员可访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!