Sendkeys.SendWait C#
Sendkeys.SendWait C#
我正在尝试单击 Windows 表单应用程序中的按钮并使用 C# 中的 SendKeys
函数将 button1.Text
写入单独的 window。有点像 "paste" 函数。但是,当我使用 SendKeys.SendWait
时,它会错误地写入文本。例如,button1.Text = "Hello World!"
会粘贴"HHHelloo Worlddd!!"
有没有办法让我获得要发送的确切字符串?
这是一个正在发生的事情的示例:
private void button1_Click(object sender, EventArgs e)
{
this.Visible = false;
SendKeys.SendWait(button1.Text);
this.Visible = true;
}
我找到了解决这个问题的方法。您可以简单地调用 SendKeys.SendWait("^(v)");
来模拟粘贴,而不是一次发送一个键并使用配置文件中的额外 xml。
我正在尝试单击 Windows 表单应用程序中的按钮并使用 C# 中的 SendKeys
函数将 button1.Text
写入单独的 window。有点像 "paste" 函数。但是,当我使用 SendKeys.SendWait
时,它会错误地写入文本。例如,button1.Text = "Hello World!"
会粘贴"HHHelloo Worlddd!!"
有没有办法让我获得要发送的确切字符串?
这是一个正在发生的事情的示例:
private void button1_Click(object sender, EventArgs e)
{
this.Visible = false;
SendKeys.SendWait(button1.Text);
this.Visible = true;
}
我找到了解决这个问题的方法。您可以简单地调用 SendKeys.SendWait("^(v)");
来模拟粘贴,而不是一次发送一个键并使用配置文件中的额外 xml。