title: Window does not get displayed(Maximized) after Minimizing
body: <p>I have a Windows CE application which logs key strokes of the mobile device. There's a button to initialize the recording functionality, which forces the main window to minimize by calling:</p>
  
  <pre><code>ShowWindow (hWnd, SW_MINIMIZE);
  </code></pre>
  
  <p>Before minimizing the window, I register to the trigger button event (via a custom API). While the app is minimized I perform some button clicks and press the trigger button to end the session. When I receive the trigger button event, I call:</p>
  
  <pre><code>ShowWindow (hWnd, SW_MAXIMIZE);
  </code></pre>
  
  <p>The problem is that the window does not get maximized. If I debug the application, I could see that the ShowWindow function is called. I could bring it to the foreground via the TaskManager by switching to the application.</p>
  
  <p>Can someone please explain the cause of this and suggest any solution that I can take?</p>
  
  <p>EDIT:
  Solution:
  Call "SetForegroundWindow" before calling ShowWindow and use SW_RESTORE instead of SW_MAXIMIZE. SW_MAXIMIZE does not work.</p>
  
  <pre><code>SetForegroundWindow (g_hWndMain);
  ShowWindow (g_hWndMain, SW_RESTORE);
  </code></pre>