title: Restore a minimized window of another application (C++ WinAPI)
body: <p>I'm working on a C++ program that which launches a .NET Winforms application.</p>
  
  <p>If the app is already running, I want to restore the window instead. I grab the .NET app's window handle and use SetForegroundWindow() to bring to to the front. </p>
  
  <p>This works except when the application is minimized. </p>
  
  <p>I've tried combinations of the following:</p>
  
  <pre><code>ShowWindow(windowHandle, SW_SHOW);
  ShowWindow(windowHandle, SW_RESTORE);
  </code></pre>
  
  <p>and</p>
  
  <pre><code>SendMessage(windowHandle, WM_SYSCOMMAND, SC_RESTORE, 0);        
  </code></pre>
  
  <p>However, when this code is executed, the event becomes stuck. In the tray I see <code>".NET-BroadcastEventWindow.2.0.0.0.378734a.0"</code> come up as a second window in the tray along with my .NET app, and the app is never restored properly.</p>
  
  <p>This only happens when I try to send a <code>SW/SC_RESTORE</code> or <code>SHOW</code> event. <code>SetForegroundWindow()</code> has no issues. </p>
  
  <p>Has anyone else seen this problem before?</p>