Results 1 to 6 of 6

Thread: WebBrowser Question

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Dec 2009
    Location
    West Warwick, RI
    Posts
    193

    Question WebBrowser Question

    I have a program I used to use to automatically log me into a website, and worked fine for years, but now the site has converted to Flash, and I can no longer specify a 'href' button click, due to the controls all being Flash-based now - I cannot find an ID for the button I need to click, and viewing the source code for the site does not show any links other than 'Get Flash Player' - Is there any way to click a Flash button at runtime via code, without knowing the button ID? This has been bugging me for days now! Any help would be greatly appreciated!

  2. #2
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: WebBrowser Question

    Nope. Flash is completely self contained. They probably adopted it specifically to stop people doing what you've been doing!
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Dec 2009
    Location
    West Warwick, RI
    Posts
    193

    Re: WebBrowser Question

    I actually figured it out, for the most part (BTW, I am part owner of the site, and my partner upgraded without notifying me first) - I use this to simulate the 'click', which DOES work, but now I can't find out how to get the coordinates of the button o.O

    Public Class Form1
    Private Declare Function SetCursorPos Lib "User32.dll" (ByVal X As Int32, ByVal Y As Int32) As Int32
    Private Declare Sub mouse_event Lib "user32" Alias "mouse_event" (ByVal dwFlags As Int32, ByVal dx As Int32, ByVal dy As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo As Int32)
    Private Const MOUSEEVENTF_LEFTDOWN As Int32 = &H2
    Private Const MOUSEEVENTF_LEFTUP As Int32 = &H4
    Private Const MOUSEEVENTF_RIGHTDOWN As Int32 = &H8
    Private Const MOUSEEVENTF_RIGHTUP As Int32 = &H10
    Private Const MOUSEEVENTF_MIDDLEDOWN As Int32 = &H20
    Private Const MOUSEEVENTF_MIDDLEUP As Int32 = &H40


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    ' Go to button
    SetCursorPos(800, 405)
    ' Click button
    mouse_event(MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0)
    mouse_event(MOUSEEVENTF_LEFTUP, 0, 0, 0, 0)
    End Sub
    End Class
    Can anyone tell me how I can find where in my WebBrowser the button is located?

  4. #4
    PowerPoster dunfiddlin's Avatar
    Join Date
    Jun 2012
    Posts
    8,245

    Re: WebBrowser Question

    Ah, well you'd need to be able to identify the button by ID or .... oh!

    You'll just have to settle on a position and hope that it doesn't shift about too much in the browser on different occasions. Time to get a new partner, perhaps?
    As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"

    Reviews: "dunfiddlin likes his DataTables" - jmcilhinney

    Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Dec 2009
    Location
    West Warwick, RI
    Posts
    193

    Re: WebBrowser Question

    Quote Originally Posted by dunfiddlin View Post
    Time to get a new partner, perhaps?
    He pays for everything, so I kind of have no choice but to let him do what he wants LOL :-P

    I miss VB6 just because I could assign a 'startup position' just by dragging the form in the preview area, but can't in NET - I can already see this is going to be a lot of 'fine tuning' to get this right :-s

  6. #6
    Frenzied Member
    Join Date
    Jul 2011
    Location
    UK
    Posts
    1,335

    Re: WebBrowser Question

    Quote Originally Posted by relentlesstech View Post
    He pays for everything, so I kind of have no choice but to let him do what he wants LOL :-P

    I miss VB6 just because I could assign a 'startup position' just by dragging the form in the preview area, but can't in NET
    The Form has a StartPosition property. You can set it to Manual in the Form's Properties Window in the Designer and then set its Location property as required

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