Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

Simulate mouse clicks and keyboard input

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
progger - 25 Feb 2008 11:51 GMT
I have a C# application that hosts an AxWebBrowser control which I automate
by sending mouse clicks and keyboard input. I have had various problems in
doing this due to a bug in the AxWebBrowser receiving input when it is
hosting a flash page however I have got it to work using SendKeys for the
keyboard input and the Windows API SendInput function for the mouse clicks
(along with Cursor.Position) however I'd like to do this in the background
either ideally when the window is out of focus, minimized or even hidden
window or at the least so the user can carry on working on the machine and
the mouse isn't captured.

Note: I've played around using mouse_event and even SendMessage but the
flash bug always got in the way and the page didn't receive the click.

Any ideas would be gratefully received.

Thanks,

Simon
Roger Frost - 25 Feb 2008 12:22 GMT
> I have a C# application that hosts an AxWebBrowser control which I
> automate
[quoted text clipped - 6 lines]
> window or at the least so the user can carry on working on the machine and
> the mouse isn't captured.

I don't believe you can send input to a control in this manor if it does not
have the focus.  SendKeys (and the such) is supposed to replicate user input
device data, and you can't input data to something that the cursor (or
pointer) isn't on.

I have an idea of how to possibly do it in the background, but just thinking
about it makes me tremble and quiver.

> Note: I've played around using mouse_event and even SendMessage but the
> flash bug always got in the way and the page didn't receive the click.

Could this possibly be due to timing issues?  Something like what is
mentioned here:

http://msdn2.microsoft.com/en-us/library/ms171548.aspx

I enjoy problems like these, they are my favorite kind to work out.

Signature

Roger Frost
"Logic Is Syntax Independent"

luukas9 - 25 Feb 2008 14:38 GMT
Hello,

I'm not sure to understand you because my poor english...

If you want to simulate a key press or mouse click, look forward to
UIAutomation API in framework 3.0 and 3.5.

look this links:

http://channel9.msdn.com/Showpost.aspx?postid=231217

http://blogs.msdn.com/abhinaba/archive/2006/06/27/648221.aspx

bye.
progger - 25 Feb 2008 15:01 GMT
Many thanks for the response however unfortunately the AxWebBrowser control
doesn't have a OnMouseClick event to call. My ideal scenario would be to
somehow create a 'virtual' window for collecting the data and then displaying
the result in a 'real' window.

Thanks,

Simon

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.