public static void PressKeys(IntPtr hWnd, params Key[] keys) { foreach (var key in keys) { UIAutomationHelper.PressKey(hWnd, key); } }
/// <summary> /// Simulates pressing several keys /// </summary> /// <param name="hWindow"></param> /// <param name="keys"></param> public static void PressKeys(IntPtr hWindow, IEnumerable <System.Windows.Input.Key> keys) { foreach (var key in keys) { UIAutomationHelper.PressKey(hWindow, key); } }
static void Main(string[] args) { Console.ReadLine(); var hWnd = UIAutomationHelper.FindChildWindow("Untitled - Notepad2-mod", "SysListView32"); hWnd = (IntPtr)0x3080A; UIAutomationHelper.PressKeys(hWnd, Key.H, Key.E, Key.L, Key.L, Key.O); Console.ReadLine(); }
/// <summary> /// Finds a window specified by the window title and set focues on that window /// </summary> /// <param name="windowName"></param> /// <returns></returns> public static IntPtr FindWindowAndFocus(string windowName) { return(UIAutomationHelper.FindWindowAndFocus(null, windowName)); }
/// <summary> /// Finds a child window /// </summary> /// <param name="windowName"></param> /// <param name="childWindowName"></param> /// <returns></returns> public static IntPtr FindChildWindow(String windowName, String childWindowName) { return(UIAutomationHelper.FindChildWindow(null, windowName, null, childWindowName)); }