Short version:
I'm not having luck using OnMessage() to call a function from a function library. It only works if it's included in the script, either explicitly or via an #Include.
Is that something that's simply not going to happen, or is there some "glue" missing somewhere?
Example, using the example code from the documentation for OnMessage().
This works as expected:
Code: Select all
Gui, Add, Text,, Click anywhere in this window.
Gui, Add, Edit, w200 vMyEdit
Gui, Show
OnMessage(0x201, "WM_LBUTTONDOWN")
return
WM_LBUTTONDOWN(wParam, lParam)
{
X := lParam & 0xFFFF
Y := lParam >> 16
if A_GuiControl
Control := "`n(in control " . A_GuiControl . ")"
ToolTip You left-clicked in Gui window #%A_Gui% at client coordinates %X%x%Y%.%Control%
}
GuiClose:
ExitApp
Code: Select all
Gui, Add, Text,, Click anywhere in this window.
Gui, Add, Edit, w200 vMyEdit
Gui, Show
OnMessage(0x201, "WM_LBUTTONDOWN")
return
#Include WM_LBUTTONDOWN.ahk
GuiClose:
ExitApp
Code: Select all
Gui, Add, Text,, Click anywhere in this window.
Gui, Add, Edit, w200 vMyEdit
Gui, Show
OnMessage(0x201, "WM_LBUTTONDOWN")
return
; WM_LBUTTONDOWN.ahk is in \Lib
GuiClose:
ExitApp