Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How click to control without mouse moving? #35

Closed
Radzhab opened this issue Dec 29, 2016 · 6 comments
Closed

How click to control without mouse moving? #35

Radzhab opened this issue Dec 29, 2016 · 6 comments

Comments

@Radzhab
Copy link

Radzhab commented Dec 29, 2016

I use demo code from wiki. All work, but my mouse) Its manually moving it. I think this library use winapi and its can click on button without mouse moving...

@Roemer
Copy link
Member

Roemer commented Dec 29, 2016

There are multiple aspects here:

  1. There is a boolean to define if the mouse should move slowly or instantly
  2. If you use the mouse clicks the mouse always need to be at the position that should be clicked. There is no way around.
  3. Maybe it us better if you use Invoke from the InvokePattern.

@Radzhab
Copy link
Author

Radzhab commented Dec 29, 2016

@Roemer , with winapi i can click on control without mouse. I think this lib allow make me win api calls

@Roemer
Copy link
Member

Roemer commented Dec 29, 2016

You can use WinAPI with SendMessage to fake clicks but then you could miss some events like mouse enter and such. I might think to add that as well but in general using patterns is better.

@Radzhab
Copy link
Author

Radzhab commented Dec 31, 2016

@Roemer why you think that i miss mouse enter event?

@Roemer
Copy link
Member

Roemer commented Dec 31, 2016

Because this one is only fired when the mouse effectively moves over an element.

@Roemer
Copy link
Member

Roemer commented Jan 3, 2017

I did some more research (again) and the SendMessage method is very unreliable (see https://blogs.msdn.microsoft.com/oldnewthing/20050530-11/?p=35513). And the SendInput method (which is the best to simulate the mouse) does not allow to "send" to other windows than the foreground window.
If you need to click a button without moving the mouse, use the invoke method from the invoke pattern. If the element you want to click does not support the invoke pattern, use your own SendMessage for this and hope that it works. Since it's unreliable, I will not add this to the FlaUI base framework. Feel free to add more comments if you still have questions.

@Roemer Roemer closed this as completed Jan 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants