Code: Select all
Gui, Add, Text,, Click anywhere in this window.
Gui, Add, Edit, w200 vMyEdit
Gui, Show
OnMessage(0x201, "WM_LBUTTONDOWN")
global functionRestoreName
return
WM_LBUTTONDOWN(wParam, lParam)
{
X := lParam & 0xFFFF
Y := lParam >> 16
if A_GuiControl
Ctrl := "`n(in control " . A_GuiControl . ")"
ToolTip You left-clicked in Gui window #%A_Gui% at client coordinates %X%x%Y%.%Ctrl%
}
GuiClose:
ExitApp
f8::
myLibraryFunction()
return
;these two functions will be in include file
;the original function name "WM_LBUTTONDOWN" will be unknown
myLibraryFunction() ;temporarily hijack windows message
{
;is it possible to programmatically detect the function name for a given windows message?
;functionRestoreName := msgFunction(0x201) ; something like this
functionRestoreName := "WM_LBUTTONDOWN"
OnMessage(0x201, "anotherLibraryFunction")
}
anotherLibraryFunction() ;once message is received set back to default behavior as specified by main script
{
tooltip temporary functionality %functionRestoreName%
OnMessage(0x201, functionRestoreName) ;restore default functionality
}