title: How can i bring a process handle window to front but in normal size not maximize?
body: <p>In the top of the class I have:</p>
  
  <pre><code>    [DllImport("USER32.DLL")]
      public static extern bool SetForegroundWindow(IntPtr hWnd);
      [DllImport("User32.dll")]
      private static extern bool ShowWindow(IntPtr handle, int nCmdShow);
      private const int SW_SHOWMAXIMIZED = 3;
  </code></pre>
  
  <p>Then in a method:</p>
  
  <pre><code>public static void BringToFront(IntPtr handle)
          {
              if (handle == IntPtr.Zero)
                  return;
  
              // Maximize window
              ShowWindow(handle, SW_SHOWMAXIMIZED);
  
              SetForegroundWindow(handle);
          }
  </code></pre>
  
  <p>But I don't want it to be maximized but normal size.</p>
  
  <p>EDIT</p>
  
  <p>This is working.</p>
  
  <p>In form1:</p>
  
  <pre><code>Process[] processes = Process.GetProcessesByName(processName);
  SetProcessWindow.BringToFront(processes[0].Id);
  SetProcessWindow.CenterProcessWindow(processes[0].Id);
  </code></pre>
  
  <p>In the class:</p>
  
  <pre><code>public static void BringToFront(int processId)
          {
              Process process = Process.GetProcessById(processId);
              IntPtr handle = process.MainWindowHandle;
  
              if (handle == IntPtr.Zero)
                  return;
  
              ShowWindow(handle, SW_SHOWNORMAL);
              SetForegroundWindow(handle);
          }
  </code></pre>