Loading ...
Sorry, an error occurred while loading the content.

Re: SendMouse/Working with Toolbars

Expand Messages
  • mike.derobio@marconi.com
    Ken, I can t recall why I didn t use the SendMouse function, but I remember having some trouble with it. I used the MouseMoveAbsPix function instead: #add
    Message 1 of 2 , Oct 3, 2002
    • 0 Attachment
      Ken,

      I can't recall why I didn't use the SendMouse function, but I remember
      having some trouble with it. I used the MouseMoveAbsPix function instead:

      #add item button
      Win32::GuiTest::MouseMoveAbsPix(120,420);
      Win32::GuiTest::SendLButtonDown();
      Win32::GuiTest::SendLButtonUp();

      Works great for me. Maybe this will work for you.

      Michael

      > I am trying to use GuiTest to test an MFC application that includes a
      > Toolbar control. I've tried to use SendMouse( "{ABSx, y}" ) to move
      > the cursor over a button, followed by SendMouse( "{LEFTCLICK}" ) to
      > trigger a button. I get an error message for the first SendMouse
      > command: "GuiTest: Unmatched mouse command!" The second command
      > works, but since the cursor hasn't moved, it doesn't help.
      >
      > The snippet looks like this:
      >
      > # Send a mouse click to the File Open button
      > SendMouse( "{ABS13, 50}" );
      > SendMouse( "{LEFTCLICK}" );
      >
      > Does anyone have any examples of using SendMouse, or testing a
      > Toolbar control?
      >
      > I've also tried PushChildButton, with the window handle for the
      > Toolbar (confirmed the HWND value with Spy++) and the control ID for
      > the button (since Toolbar buttons don't have titles). This also
      > failed, but without any message.
      >
      > Thank you,
      > Ken Hommel
    • Ken Hommel
      Thanks for your response. That s almost exactly what I m doing. I just wrote a sub to take the x and y coordinates: sub Click( $$ ) { my( $myX, $myY ) = @_;
      Message 2 of 2 , Oct 8, 2002
      • 0 Attachment
        Thanks for your response. That's almost exactly what I'm doing. I
        just wrote a sub to take the x and y coordinates:

        sub Click( $$ ) {
        my( $myX, $myY ) = @_;

        SendMouseMoveAbs( $myX, $myY );
        SendLButtonDown();
        SendLButtonUp();

        sleep 1;
        }

        I usually do something like a mouse click and then test to see if the
        appropriate dialog was displayed by the program under test. I found I
        get more consistent test results if I add a "sleep 1" after any mouse
        click or button press.

        Thanks again,
        -Ken

        --- In perlguitest@y..., mike.derobio@m... wrote:
        >
        >
        > Ken,
        >
        > I can't recall why I didn't use the SendMouse function, but I
        remember
        > having some trouble with it. I used the MouseMoveAbsPix function
        instead:
        >
        > #add item button
        > Win32::GuiTest::MouseMoveAbsPix(120,420);
        > Win32::GuiTest::SendLButtonDown();
        > Win32::GuiTest::SendLButtonUp();
        >
        > Works great for me. Maybe this will work for you.
        >
        > Michael
        >
        > > I am trying to use GuiTest to test an MFC application that
        includes a
        > > Toolbar control. I've tried to use SendMouse( "{ABSx, y}" ) to
        move
        > > the cursor over a button, followed by SendMouse( "{LEFTCLICK}" )
        to
        > > trigger a button. I get an error message for the first SendMouse
        > > command: "GuiTest: Unmatched mouse command!" The second command
        > > works, but since the cursor hasn't moved, it doesn't help.
        > >
        > > The snippet looks like this:
        > >
        > > # Send a mouse click to the File Open button
        > > SendMouse( "{ABS13, 50}" );
        > > SendMouse( "{LEFTCLICK}" );
        > >
        > > Does anyone have any examples of using SendMouse, or testing a
        > > Toolbar control?
        > >
        > > I've also tried PushChildButton, with the window handle for the
        > > Toolbar (confirmed the HWND value with Spy++) and the control ID
        for
        > > the button (since Toolbar buttons don't have titles). This also
        > > failed, but without any message.
        > >
        > > Thank you,
        > > Ken Hommel
      Your message has been successfully submitted and would be delivered to recipients shortly.