title: Reliable way to restore/maximize application window from VBscript
body: <p>I have visual basic script that among other things creates IE instance, hides it, manipulates it and then make it visible to the user.</p>
  
  <p>Unfortunately, the restore function does not work on all PCs for unclear reason. The current code is:</p>
  
  <pre><code>objectIE.Visible = True
  wshShell.AppActivate objectIE 'which is I think wrong as objectIE is not PID.
  wscript.sleep timoutSleep
  wshShell.SendKeys restWindow 'which is "% r" and will not work on all locales :(
  </code></pre>
  
  <p>I think the problem is in this line:</p>
  
  <blockquote>
    <p>wshShell.AppActivate objectIE</p>
  </blockquote>
  
  <p>I think here I need to pass PID to the <code>AppActivate</code> method. </p>
  
  <p><strong>Question</strong>: How to get PID of the IE object? or <code>wshShell.AppActivate objectIE</code> is correct and I'm looking in a wrong direction?</p>
  
  <p>P.S. I can't use the application's title as it is not unique :(</p>