title: How to use ShellExecuteEx() without stealing the focus of the opener window
body: <p>I am trying to open a browser through my application but I do not want it to run in the foreground and steal the focus from my application.</p>
  
  <p><strong>The code:</strong></p>
  
  <pre><code>case WM_COMMAND:
  {
      SHELLEXECUTEINFO ShExecInfo;
      ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
      ShExecInfo.fMask = NULL;
      ShExecInfo.hwnd = NULL;
      ShExecInfo.lpVerb = L"open";
      ShExecInfo.lpFile = L"http://www.microsoft.com";
      ShExecInfo.lpParameters = NULL;
      ShExecInfo.lpDirectory = NULL;
      ShExecInfo.nShow = SW_HIDE;
      ShExecInfo.hInstApp = NULL;
      ShellExecuteEx(&amp;ShExecInfo);
      SetForegroundWindow(hwnd);
  }
  return 0;
  </code></pre>
  
  <p>In my application, there is a button which is sending the command message to execute the opening code, but my application goes to the background and the browser comes to the foreground.</p>
  
  <p>How to solve this problem?</p>