title: How can I get a handle to a window of executed process in VBA?
body: <p>In my VBA application I start IExplore process with:</p>
  
  <pre><code>Shell sIE, vbMaximizedFocus
  </code></pre>
  
  <p>Now I need to resize created window. For that I can use SetWindowPos function, which takes a handle to the window as one of the arguments. And I don't have that handle...</p>
  
  <p>I would use FindWindowLike function (which goes threw windows, compares caption with pattern and returns array of handles of windows with matching caption), but I cann't rely on window caption. I cann't just resize all of the IE windows also.</p>
  
  <p>So, I was thinking of using SOMETHING that would give me a handle of a window to the process I just ran. Shell does not provide this.</p>
  
  <p>I have some example code, how to do this in C++ using CoCreateInstance function:</p>
  
  <pre><code>    CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER, IID_IWebBrowser2, (void**)&amp;m_pBrowser);
          if (m_pBrowser)
          {
              pom  = buffer;
              m_pBrowser-&gt;put_Visible(VARIANT_TRUE);
              m_pBrowser-&gt;Navigate(pom, &amp;(_variant_t(flaga)), &amp;vDummy, &amp;vDummy, &amp;vDummy);
              m_pBrowser-&gt;get_HWND((long *)&amp;hWnd);
              if (hWnd != NULL)
              {
               ...
               ...
  </code></pre>
  
  <p>I would've port this to VBA, but I'm not so sure, what to put for fourth parameter:</p>
  
  <blockquote>
    <p>riid
        [in] Reference to the identifier of the interface to be used to communicate with the object.</p>
  </blockquote>
  
  <p>Well I don't know witch interface I should pass... I'm not even sure if I can use it in VBA.</p>
  
  <p>So. Is there a way to execute process, which would provide me a handle to it's window?</p>