Page 1 of 1

the example of AHK Command source code

Posted: 07 May 2019, 04:36
by euras
Hi,
I'm curious how the source code of the commands in AHK looks like. Maybe someone has an example?
I.e. we use the syntax

Code: Select all

Send, this is a text
, but what is behind that Send?

Re: the example of AHK Command source code

Posted: 07 May 2019, 09:40
by WalkerOfTheDay

Re: the example of AHK Command source code  Topic is solved

Posted: 07 May 2019, 15:47
by Alguimist
Send is coded in keyboard_mouse.cpp, in a very long function called SendKeys.

It is essentially WM_KEYDOWN via PostMessage.

Code: Select all

Send(hWnd, String) {
    Loop % StrLen(String) {
        PostMessage 0x100, GetKeyVK(SubStr(String, A_Index, 1)), 1,, ahk_id %hWnd% ; WM_KEYDOWN
    }
}
In the Help folder of AutoGUI, there is a file called AHK-WinAPI.htm. I believe that more than 80% of AHK commands, functions and variables are briefly described in it, but Send is not there yet.