using System.Diagnostics;
using System.ComponentModel;
namespace MyProcessSample
public static class WindowHelper
public static void BringProcessToFront(Process process)
IntPtr handle = process.MainWindowHandle;
ShowWindow(handle, SW_RESTORE);
SetForegroundWindow(handle);
const int SW_RESTORE = 9;
[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool SetForegroundWindow(IntPtr handle);
[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool ShowWindow(IntPtr handle, int nCmdShow);
[System.Runtime.InteropServices.DllImport("User32.dll")]
private static extern bool IsIconic(IntPtr handle);
public static void Main(string[] args)
foreach(string arg in args)
Process process = Process.GetProcessById(Int32.Parse(arg));
WindowHelper.BringProcessToFront(process);