开发者

SENDKEYS F-Key sends trema Y (Y with two dots over it)

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>
 开发者_JAVA技巧   <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));
    }
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜