Sign in to follow this  
Followers 0
Mixam

Best way to move mouse click then move back

3 posts in this topic

I am unsure which method would be the best to use:

_GUICtrlToolbar_ClickButton()

or something involving

DllCall("user32.dll", "int", "SetCursorPos", "int", $x, "int", $y)

I'm refreshing icons in the system tray so I want this to click on each button without disturbing what is going on with the mouse. I'm currently using _GUICtrlToolbar_ClickButton() and I see the mouse flicker a bit when its running. Also if I move the mouse while it is doing the tray refresh, sometimes it misses an icon down there. I was wondering if there is a way to click on icons in the tray without even moving the mouse, or if using dllcall with user32.dll might be a better solution for me. Any help would be greatly appreciated.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$pos1 = MouseGetPos()
mouseclick("left",x,y,1,0) 
MouseMove($pos1[0], $pos1[1], 0)

Edited by EscapeTheFate

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I was wondering if there is a way to click on icons in the tray without even moving the mouse, or if using dllcall with user32.dll might be a better solution for me.

I am 90% sure that there is no easy/clean solution for dealing with anything in the system tray. The mouse must actually position itself over each icon manually and you will see at least a brief flicker of the mouse. Valik wrote a function years ago that refreshes the system tray by doing just this. Try analyzing that function for ways to optimize what you are trying to accomplish.

Valik's function.

*Hint: It does use SetCursorPos to move the mouse as it is faster than MouseMove. This is noted in the preamble.

Edited by Saunders

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0