title: Shell Execute From Explorer
body: <p>Trying to follow this sample:
  <a href="https://devblogs.microsoft.com/oldnewthing/20040520-00/?p=39243" rel="nofollow noreferrer">https://devblogs.microsoft.com/oldnewthing/20040520-00/?p=39243</a></p>
  <pre><code>void ShellExecuteFromExplorer(PCWSTR pszFile,    PCWSTR pszParameters = nullptr,    PCWSTR pszDirectory  = nullptr,    PCWSTR pszOperation  = nullptr,    int nShowCmd         = SW_SHOWNORMAL)
  {
      CComPtr&lt;IShellFolderViewDual&gt; spFolderView;
      GetDesktopAutomationObject(IID_PPV_ARGS(&amp;spFolderView));
      CComPtr&lt;IDispatch&gt; spdispShell;
      spFolderView-&gt;get_Application(&amp;spdispShell);
      CComQIPtr&lt;IShellDispatch2&gt;(spdispShell)
         -&gt;ShellExecute(CComBSTR(pszFile),
                        CComVariant(pszParameters ? pszParameters : L&quot;&quot;),
                        CComVariant(pszDirectory ? pszDirectory : L&quot;&quot;),
                        CComVariant(pszOperation ? pszOperation : L&quot;&quot;),
                        CComVariant(nShowCmd));
  }
  </code></pre>
  <p>In this case, how do i retrieve the <code>pid</code> from the process being launch from the <code>ShellExecute</code>?</p>