Re: Simulate mouse clicks and keyboard input

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




"progger" <SimonMorrow@xxxxxxxxxxxxxxxx> wrote in message news:847E90F2-7745-48B4-8E19-C7E157025C96@xxxxxxxxxxxxxxxx
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.


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.


--
Roger Frost
"Logic Is Syntax Independent"

.



Relevant Pages

  • Re: Program Crashing From Running Too Fast?
    ... ISTR this is the Windows code for a segfault. ... you have a bug in your program elsewhere that causes ... > it possible for a console window to accept keyboard input without ... > the entire program to have it run in a window. ...
    (comp.lang.cpp)
  • Re: [opensuse] Textbook example of what is right & wrong with the kde bug reporting/fixing proce
    ... from that the bug was triaged inside a week and fixed in 4 and a bit months. ... I would also not generalise from this to all KDE 4 bugs. ... changes required just to get a window to appear in kde4. ... these tutorials aren't there to show you the most abbreviated ...
    (SuSE)
  • Re: How did you learn your debugging skills?
    ... > trace points in the program, and use them to narrow down where the bug is. ... A common manual debugging technique is a temporary trace statement, ... A window controlled by a Test Case is the same kind of thing - a simple I/O ... the window-the fixture that usually suppresses it. ...
    (comp.programming)
  • Re: [kde] KWin does not generate window shadows for VLC
    ... VLC bypasses the window manager it seems, ... I'm using SMPlayer mainly, but I've come across some missing features ... I've not tried with other video players yet, but with smplayer (0.6.9, ... yet doesn't suffer the same bug. ...
    (KDE)
  • Re: Java and avoiding software piracy?
    ... dummy files in each and drag files back and forth for a while. ... from such behavior is therefore ipso facto a bug. ... moved it to another window open on the same directory, ... Even supposing the directory is sorted by modified date, ...
    (comp.lang.java.programmer)