Refreshing IE window automatically does not work in VB.Net <p>I have tried to write a simple function to bring an Internet Explorer windows to the foreground and then press F5 to refresh it using the dll function:</p> <pre><code> Declare Function SetForegroundWindow Lib "user32" (ByVal hwnd As Integer) As Integer </code></pre> <p>and then later call this function using:</p> <pre><code> SetForegroundWindow(processID.MainWindowHandle.ToInt32) SendKeys.Send("{F5}") </code></pre> <p>However, when I tried to debug the code, the setforeground does not work.</p> <p>I am using a Windows 2008 (64 bit) so I thought I should use ToInt64 instead. However that did not seem to do the trick as well, when I called SetForegroundWindow, nothing seems to come up. </p> <p>Is there any other recommendation? I am using VS 2008.</p> <p>Many thnaks!</p>