Simulate mouse clicks and keyboard input

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cHJvZ2dlcg==?=

    Simulate mouse clicks and keyboard input

    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

    #2
    Re: Simulate mouse clicks and keyboard input


    "progger" <SimonMorrow@ne wsgroup.nospamw rote in message
    news:847E90F2-7745-48B4-8E19-C7E157025C96@mi crosoft.com...
    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:





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


    --
    Roger Frost
    "Logic Is Syntax Independent"

    Comment

    • luukas9

      #3
      Re: Simulate mouse clicks and keyboard input

      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:

      Browse thousands of hours of video content from Microsoft. On-demand video, certification prep, past Microsoft events, and recurring series.




      bye.

      Comment

      • =?Utf-8?B?cHJvZ2dlcg==?=

        #4
        Re: Simulate mouse clicks and keyboard input

        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

        Comment

        Working...