public partial class MainWindow : Window { [DllImport("user32.dll", EntryPoint="FindWindow", SetLastError = true)] static extern IntPtr FindWindowByCaption(IntPtr ZeroOnly, string lpWindowName); [DllImport("user32.dll")] [return: MarshalAs(UnmanagedType.Bool)] static extern bool SetForegroundWindow(IntPtr hWnd); public MainWindow() { InitializeComponent(); } private void button1_Click(object sender, RoutedEventArgs e) { SetForegroundWindow(FindWindowByCaption(IntPtr.Zero, "Untitled - Notepad")); SendKeys.SendWait("A"); }
SendKeys
InputManager
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)