Results 1 to 2 of 2

Thread: Hyperlinks in a webbrowser control

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2000
    Posts
    11

    Question

    I have a webpage loaded in a webbrowser control and there is a hyperlink on it. Now I need the program to automaticly click the hyperlink. Is this possible??


  2. #2
    Guest
    Well, you can use SendKeys to make the scrollbar to the point of where the hyperlink is.

    Code:
    WebBrowser1.SetFocus
    SendKeys "{DOWN 15}" 'goes down 15 times
    And then you can use the SetCursorPos api function to set the cursor to where the link is.

    Code:
    Declare Function SetCursorPos Lib "user32.dll" (ByVal _
    x As Long, ByVal y As Long) As Long 
    
    Usage
    
    Dim retval As Long 
    retval = SetCursorPos(x, y)
    And then to make the mouse click, you can use the mouse_event api function to make the mouse click.

    Code:
    Declare Sub mouse_event Lib "user32.dll" (ByVal _
    dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal _
    cButtons As Long, ByVal dwExtraInfo As Long)
    
    Const MOUSEEVENTF_LEFTDOWN = &H2
    Const MOUSEEVENTF_LEFTUP = &H4
    
    Usage
    
    mouse_event MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0
    mouse_event MOUSEEVENTF_LEFTUP, 0, 0, 0, 0


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