Jump to content

Best way to move mouse click then move back


Recommended Posts

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.

Link to comment
Share on other sites

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
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...