public Window runOp(Window hWnd) { AutoItX3Lib.AutoItX3Class au3 = new AutoItX3Lib.AutoItX3Class(); string name = settings["app_name"]; //au3.Opt("WinTitleMatchMode", 4); au3.WinActivate(hWnd.handle, ""); au3.WinWaitActive(hWnd.handle, "", 5); au3.WinClose(hWnd.handle, ""); au3.WinWaitClose(hWnd.handle, "", 5); if (!hWnd.myProc.HasExited) { hWnd.myProc.CloseMainWindow(); hWnd.myProc.Kill(); } Time.stopTimer(name, "runtime"); return hWnd; }