title: How to get the window handle of another app minimized to the system tray?
body: <p>Instance A is trying to restore instance B's window, but I can't get the B's window handle. I think the problem is that the window is being minimized by B to the system tray using:</p>
  
  <pre><code>this.Visibility = Visibility.Hidden;
  </code></pre>
  
  <p>And A is trying to get B's window handle using:</p>
  
  <pre><code>Process process = Process.GetCurrentProcess();
  Process.GetProcessesByName(process.ProcessName).First().MainWindowHandle;
  </code></pre>
  
  <p>Which is equal to <code>IntPtr.Zero</code>.</p>
  
  <p>I also tried to get the window handle by class name using Spy++ but the class name has a per-instance GUID in the following format:</p>
  
  <pre><code>HwndWrapper[FileName.exe;;ad445199-cf93-48a4-bd24-2f97d54c8af8]
  </code></pre>