title: Win32 ::SetForegroundWindow() not working all the time
body: <p>I'm working on a messenging tool. The messaging window is part of a whole application. I need the window to go to the front when there are some messages coming. I'am using this code :</p>
  
  <pre><code>    if( m_hwnd == NULL || !::IsWindow(m_hwnd) )
          return E_UNEXPECTED;
  
      if(::IsIconic(m_hwnd))
      {
          ::ShowWindowAsync( m_hwnd, SW_RESTORE );
      }
      ::SetWindowPos(m_hwnd, HWND_TOP, 0, 0, 0, 0, SWP_ASYNCWINDOWPOS | SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
      ::SetForegroundWindow(m_hwnd);
      if( pvbProcessed != NULL )
          *pvbProcessed = VARIANT_TRUE;
  
      return S_OK;
  </code></pre>
  
  <p>I even tried to do a TOPMOST but still in some cases it does not work. 
  I also Tried a ::BringToFront().</p>
  
  <p>Anyone can help or give an explanation on why it doen not work ? Is it a known microsoft limitation.</p>