Question Beginner question about hooks (scrolling and SendInput)

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

youki

Full Member
Sep 5, 2020
2
102
0
How long you been coding/hacking?
4-5 years
Hello,
I'm not a gamer. I hope that you appreciate it that my english is not that good, so it's sometimes a little bit hard to understand technical documentations.

I just want to program a simple application in c# where i catch the scrolling of a mouse globally and control it. For i.e.: I want to scroll up and down by the tilt left/right key.
I tried a few libraries of another forum but it doesn't work without a lag when i use SendInput in their wheel event. The hooks were based on WH_MOUSE_LL. I assume that i have to use a hook based on WM_GETMESSAGE that i can pass WM_NULL, so that my injected input works correctly without a lag in my own wheel event. It looked like the used libraries don't stop the passing of the input by the mouse.
Should it work without a problem or do i have to consider further things or maybe another hook type?

Best regards
 

Rake

Cesspool Admin
Administrator
Jan 21, 2014
12,065
78,998
2,370
You want to switch the axis on the mouse wheel? You want it to scroll when you tilt it horizontally?

I don't have much experience with that, but using logic I came up with these ideas:

Hook on WM_MOUSEHWHEEL
make it perform the scroll

Hook on WM_MOUSEWHEEL
block injected mouse events


OR:

Hook on WM_MOUSEHWHEEL
make it perform the scroll
set bSimulatingScroll to true;

Hook on WM_MOUSEWHEEL
if bSimulatingScroll == true, discard these events
 

youki

Full Member
Sep 5, 2020
2
102
0
You want to switch the axis on the mouse wheel? You want it to scroll when you tilt it horizontally?

I don't have much experience with that, but using logic I came up with these ideas:

Hook on WM_MOUSEHWHEEL
make it perform the scroll

Hook on WM_MOUSEWHEEL
block injected mouse events


OR:

Hook on WM_MOUSEHWHEEL
make it perform the scroll
set bSimulatingScroll to true;

Hook on WM_MOUSEWHEEL
if bSimulatingScroll == true, discard these events

Hi,
I tested it again but i can't figure it out what the cause is.

(@Rake: the following is what you mean?!)
- I use LLMHF_INJECTED to block injected inputs in the hook procedure
- I return a non zero value in the hook procedure to block the passing of the message to the application's window

I tested 3 things with :
- If i scroll up with the mouse nothing happens as expected in the application's window
- If i use SendInput (MOUSEEVENTF_HWHEEL) initiated by a button, it scrolls immediately
- If i scroll up with SendInput (MOUSEEVENTF_HWHEEL) in my scroll event, it scrolls horizontally and unexpected up with a delay

That's so weird, something is getting passed when i use SendInput in my scroll event.

Should i use SendInput in the way i'm using it or is there a better way to inject mouse inputs?
(I'm asking my self how AHK and X-Mouse Contro do it.)

Regards
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Similar threads

Community Mods