CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Guest

    sendkeys procedure

    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?


  2. #2
    Join Date
    Jan 2000
    Posts
    19

    Re: sendkeys procedure

    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.


  3. #3
    Join Date
    Apr 1999
    Posts
    6

    Re: sendkeys procedure

    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





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured