OnMessage(...): how work it?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

OnMessage(...): how work it?

Post by Archimede » 07 Aug 2022, 07:15

hallo.
I have a program like this:
Gui...
.
.
.
OnMessage(0x00FF, "InputMsg")
.
.
.
InputMsg(wParam, lParam)
{
.
.
.
}
I would know what are the wParam and lParam arguments; when the function InputMsg(...) is automatically called, how that arguments are charged, who charge that, and how are passed?
Thank you very much

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: OnMessage(...): how work it?

Post by swagfag » 07 Aug 2022, 07:31

if the message code is meant to be that of WM_INPUT, then read the WM_INPUT docs: https://docs.microsoft.com/en-us/windows/win32/inputdev/wm-input
if not, then read whatever application's docs ure expecting to receive such a message from

User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: OnMessage(...): how work it?

Post by boiler » 07 Aug 2022, 07:33

As you were told yesterday, it depends. Do you have a specific purpose for using it? It can be used to receive Windows messages or communication from another process like another one of your scripts. The values of the parameters depend on the message.

Edit: What swagfag said.

Please use [code][/code] tags when posting code. Thank you.

Archimede
Posts: 503
Joined: 25 Nov 2021, 09:49
Location: Switzerland / Italy

Re: OnMessage(...): how work it?

Post by Archimede » 07 Aug 2022, 10:18

:-)
Thank you very much for your patience.
I studied very much on your link (and much more) and I think I am to begin to understand the HID API working.
I red how to register a HID device to generate the WM_INPUT message and lParam and wParam parameters.
I hope to understand it well.
Now I have a small problem: after an HID registration I would to receive immediately a WM_INPUT message, without waiting for a key press: is it possible? how?
Thank you very much.

I am using AHKHID funcrtions downloaded from this site (it is a very good work); I am updating instructions tha are not enough (for my opinion): if you are interested, at the end of the work I can send you the updated instructions.

Post Reply

Return to “Ask for Help (v1)”