/// <summary> /// Activates the window represented by the handle and /// sets it as the foreground window /// </summary> /// <param name="handle"></param> private void activateWindow(IntPtr handle) { if (handle != IntPtr.Zero) { User32Interop.BringWindowToTop(handle); User32Interop.SetFocus(handle); Thread.Sleep(1000); Windows.SetForegroundWindow(handle); } }
private void cancel() { if (_selectedTask != null) { User32Interop.SetForegroundWindow(_selectedTask.Handle); User32Interop.ShowWindow(_selectedTask.Handle.ToInt32(), User32Interop.SW_SHOW); User32Interop.BringWindowToTop(_selectedTask.Handle); } Windows.CloseForm(this); }