title: How to set focus on other application based on process name VB
body: <p>How can I set focus on other application based on process name in VB2010?</p>
  
  <p>What I can do now is set focus on other application based on windows name using FindWindow then use SetForegroundWindow. Below is what I currently have</p>
  
  <pre><code>        Dim theHandle As IntPtr
          theHandle = FindWindow(Nothing, "Gmail: Email from Google")
          If theHandle &lt;&gt; IntPtr.Zero Then
          SetForegroundWindow(theHandle)
  </code></pre>
  
  <p>The problem is that FindWindow need exact windows name to works and I don't always know the exact name. (Because my program open up different website that the user enter, so I have no control over they site they open). So is there anyway that I can set focus using the process name instead? (in this case firefox.exe)  Any other suggestions are welcome. </p>
  
  <p>Thanks</p>