Does anyone know why this is? Is there a better way to detect active window change without using a timer?
Code: Select all
Gui +LastFound
hWnd := WinExist()
DllCall( "RegisterShellHookWindow", UInt,Hwnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
ShellMessage( wParam,lParam )
{
WinGetTitle, title, ahk_id %lParam%
If (wParam=4) { ;HSHELL_WINDOWACTIVATED
ToolTip WinActivated`n%Title%
sleep 1000
ToolTip
}
}