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

Doesn't hide app-specific pointers like Cross in Excel #2

Open
eugenesvk opened this issue Nov 18, 2023 · 4 comments
Open

Doesn't hide app-specific pointers like Cross in Excel #2

eugenesvk opened this issue Nov 18, 2023 · 4 comments

Comments

@eugenesvk
Copy link

Or reverse arrow in WordPad near the border or "hide whitespace" cursor in Word etc.

Do you know how to hide those? (AutoHideMouseCursor hides those, but it's not open source, so not sure how)

@setsumi
Copy link
Owner

setsumi commented Nov 19, 2023

I don't know how, but guessing it requires to somehow mess with the target process directly. This is not safe (possible malware alert) and straightforward as hiding standard system pointers. I can try looking into it but cannot promise results.

@eugenesvk
Copy link
Author

eugenesvk commented Nov 19, 2023

I think a simpler solution without hooking anything could be to create an invisible GUI element, using the target window as its parent, and then invoking ShowCursor, that should steal the pointer from the active window, so something like this in AutoHotkey

!5::hide_mouse_pointer()
hide_mouse_pointer() {
  static isHidden := 0
   , guiBlock := Gui()
  if isHidden = 0  {
    MouseGetPos(,,&winID,)
    guiBlock.Opt("+Owner" . winID) ; make the GUI owned by winID
    DllCall("ShowCursor", "int",0)
    isHidden := 1
  } else {
    DllCall("ShowCursor", "int",1)
    isHidden := 0
  }
}

@setsumi
Copy link
Owner

setsumi commented Nov 20, 2023

Nice trick, saved a lot of trouble. Thank you.
Made the update.

@eugenesvk
Copy link
Author

Thanks for the update!

I've noticed that if you change timeout then it stops working for app pointers (continues to work for regular pointers), restarting the target app (or MousePuff) fixes it

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