SENDKEYS F 键发送 Trema Y(Y 上有两个点)
我正在尝试将 F 键从我正在编写的 C# 应用程序发送到应用程序。当我发送任何 F 键时,它显示为 Ÿ (trema Y)。一旦我将所需的寡妇置于焦点上,我就会满足于以编程方式按下所需的 F 键的 .NET。
当我在开发机器上运行代码时,F 键被正确解释。将它们解释为 trema Y 的机器是 Windows 7 .NET 4 客户端 64 位。
我尝试过 SendKeys.SendWait("{F2}")
和 SendKeys.Send("{F2}")
。我的 app.config 中有以下代码:
<appSettings>
<add key="SendKeys" value=" JournalHook"/>
</appSettings>
这是我的代码示例:
void PopTargetApp()
{
try
{
string TargetWindowTitle;
TargetWindowTitle = "notepad";
int iHandle = NativeWin32.FindWindow(null, TargetWindowTitle);
NativeWin32.SetForegroundWindow(iHandle);
SendKeys.SendWait("{F2}");
SendKeys.Flush();
//Thread.Sleep(1000);
SendKeys.SendWait(currentInteraction.Account + "{Enter}");
SendKeys.Flush();
toolStripStatusLabel1.Text = String.Format("{0} {1}", TargetWindowTitle, iHandle.ToString());
}
catch (System.Exception ex)
{
MessageBox.Show(String.Format("Method: {0} \nError: {1} ", MethodInfo.GetCurrentMethod().Name, ex.Message));
}
}
I’m trying to send F-Keys to an application from a C# app I’m writing. When I send any F-Key it shows up as Ÿ (trema Y). I would settle for .NET programmatically pressing desired F-Key once I’ve brought the desired widow to focus.
When I run the code on my development machine the F-Keys are interpreted correctly. The machine that is interpreting them as trema Y is a Windows 7 .NET 4 Client 64 BIT.
I’ve tried SendKeys.SendWait("{F2}")
and SendKeys.Send("{F2}")
. I have the following code in the app.config:
<appSettings>
<add key="SendKeys" value=" JournalHook"/>
</appSettings>
Here is my code example:
void PopTargetApp()
{
try
{
string TargetWindowTitle;
TargetWindowTitle = "notepad";
int iHandle = NativeWin32.FindWindow(null, TargetWindowTitle);
NativeWin32.SetForegroundWindow(iHandle);
SendKeys.SendWait("{F2}");
SendKeys.Flush();
//Thread.Sleep(1000);
SendKeys.SendWait(currentInteraction.Account + "{Enter}");
SendKeys.Flush();
toolStripStatusLabel1.Text = String.Format("{0} {1}", TargetWindowTitle, iHandle.ToString());
}
catch (System.Exception ex)
{
MessageBox.Show(String.Format("Method: {0} \nError: {1} ", MethodInfo.GetCurrentMethod().Name, ex.Message));
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论