none
sendkeys RRS feed

All replies

  • For example, this sends ENTER + TAB to Notepad :

    Process proc = System.Diagnostics.Process.Start(new ProcessStartInfo("notepad"));
    proc.WaitForInputIdle();
    if ((proc.MainWindowTitle != ""))
    {
        //AppActivate(proc.Id);
        SwitchToThisWindow(proc.MainWindowHandle, true);                    
        SendKeys.Send("{ENTER}{TAB}");
    }

    [DllImport("User32.dll", SetLastError= true)]                           
    public static extern bool SwitchToThisWindow(IntPtr hWnd, bool fAltTab);

    Saturday, January 18, 2020 10:03 AM
  • Hi moosavi061,

    Thank you for posting here.

    Just a reminder:

    The code example of Castorix31 can be run directly in the WinForm application, but if you want to use it in the Console application, please replace SendKeys.Send ("{ENTER} {TAB}"); with SendKeys.SendWait ("{ENTER} { TAB} ");

    Best Regards,

    Timon


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 20, 2020 1:49 AM