Click to See Complete Forum and Search --> : sendkeys procedure


January 28th, 2000, 06:32 PM
how can I make it so that IE 5 loads up. Then it goes to a website. Then it presses F5 on IE 5. After that, it pauses for like 5 seconds.... how could I do that?

rino_2
January 29th, 2000, 09:22 AM
You can't. Well you could but its not practical. You would have to click inside the address bar and wait till you programm send the address. If you did do it you would do it like this:

------------------------------------------
Private Declare Function Sleep Lib "Kernel32" (ByVal dwMilliseconds As Long) As Long

Private Sub Form_Load()
Sleep 5000 'Give you five seconds to click inside the address bar
SendKeys "http://www.vb-world.net"
Sleep 1000 'Wait 1 second
sendkey "{F5}"
End Sub
------------------------------------------

Really there is no point.

Chris A
January 29th, 2000, 06:08 PM
Actually, rino_2's post to this question is partly incorrect. You can open up a URL and then have it refresh. Here is the code:


private Declare Function ShellExecute& Lib "shell32.dll" Alias "ShellExecuteA" (byval hwnd as Long, byval lpOperation as string, byval lpFile as string, byval lpParameters as string, byval lpDirectory as string, byval nShowCmd as Long)
private Declare Function Sleep Lib "kernel32" (byval dwMilliseconds as Long) as Long

private Const SW_MAX = 3
private Const OPEN_URL = "http://gatecontrol.pair.com"

private Sub Command1_Click()
res& = ShellExecute(hwnd, "open", OPEN_URL, vbNullString,CurDir$, SW_MAX)
Sleep (3000)
SendKeys "{F5}"
End Sub