SetWindowsHookEx redirect input to background window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
thinkRand
Posts: 44
Joined: 02 Mar 2022, 04:16
Location: Somewhere in Venezuela
Contact:

SetWindowsHookEx redirect input to background window

05 Nov 2022, 16:35

Hello, fellow programmers

I want help here if possible. My problem is that i am installing a global keyboard hook to receive every WM_ related with it and i want to redirect that input to an specific window. This is for a application where ContrlSend dosent work, but send commands with the app focused works as expected. However the app has to work in the background.

My first issue is that i dont know how is the structure of the Windows Message i am getting inside the keyboard hook callback. Let me point out some code

The installation works well

Code: Select all


SetWindowsHookEx(WH_KEYBOARD_LL:=13, RegisterCallback("keyboard"))
My problem is Inside the keyboard callback. I get wParam as KEY_DOM OR KEY_UP, and the lParam is the rest of the info i need. I am stuck here because I dont know
how is the structure in lParam, also would help me a lot if anyone can point out where is the documentation for the structure i got here inside the callback. I searched without luck.

Code: Select all

keyboard(nCode, wParam, lParam){

Tooltip, Hey there
 ;wParam is KEY_DOWN or KEY_UP
;lParam has the info i need, but i did not foudn documentation to know how is the structure

}

Another question. If i post a message to the message loop of a window and that message is being discarted what is the difereccion when using sendInput(), i think that
sendInput post a message to the message loop too. does not it?

I want to imitate the behavior of sendInput but for background apps.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], peter_ahk and 380 guests