Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sending simulated click via WebBrowser in C# to flash object embedded in HTML

Tags:

browser

c#

I have not been able to find a way to send a simulated click to a flash .SWF application on a site I'm visiting using the WebBrowser control in WinForms.

Though I've read countless posts on the subject, there seems to not be much information floating around on the internet. The only resources I've found here that technically provide answers for my question are:

Reading Packets - This link recommends reading the packets sent from the flash application and might be my only working solution.

Requiement: I do not wish to communicate directly with ActionScript to obtain my results. I just want it to blindly click the flash movie and wait for something to happen.

If it is not possible, I'd like feedback anyway. Thank you!


UPDATE: (3/23/2012 - 23/3/2012)

Since no feedback, I figured I'd post an update

I wound up just sniffing the packets sent by the .SWF, and then sent that same data via the webBrowserObject.Navigate method. Thanks anyway!


UPDATE: 3/31/2012 - 31/3/2012

Wound up bringing back to life my old debate of whether or not to use SendMessage or PostMessage to send an actual click to the window without hijacking the mouse. It seemed beneficial to have both the physical and imitated clicks as options/features for the program, so I wound up implementing the physical click as well, via PostMessage. What I did was: Grabbed the handle from the WebBrowser.Handle, looped through the handles, stopped looping at the "Internet Explorer_Server" handle, and then PostMessage()'d a double click to it at the coordinates specified.

I hope this update is helpful for anyone who is reading up on ways to send clicks to the WebBrowser control without invoking a simulated click on a dom element.

like image 630
Spencer Avatar asked Nov 13 '22 08:11

Spencer


1 Answers

Have you looked in to the gory details of http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx ?

like image 199
Martijn Avatar answered Nov 16 '22 02:11

Martijn