Code: Select all
hwnd:=ProcessExist("Notepad.exe") ;if exist,return ahk_pid or return 0
hwnd:=format("0x{:X}",hwnd)
WH_GETMESSAGE := 3
hooker:=DllCall("SetWindowsHookEx", "int",WH_GETMESSAGE, "Uint", RegisterCallback("Navigate", "Fast"), "Uint", DllCall("GetModuleHandle", "Uint", 0), "Uint",hwnd)
Return
Navigate(nCode, wParam, lParam)
{
Critical
ToolTip % nCode "`n" wParam "`n" lParam
Return DllCall("CallNextHookEx", "Uint", hooker, "int", nCode, "Uint", wParam, "Uint", lParam)
}
ProcessExist(ProcessName){
Process,Exist,% ProcessName
return ErrorLevel
}