All tests throw a "Is Not Child" result even when opening a Find window in Notepad++ which (I believe) is a child window of the Notepad++ main window
Any thoughts?
Code: Select all
GroupAdd, HotGrp, ahk_exe Notepad++.exe
IsChildWindow(Parent, WinHnd) {
Local DllRes
DllRes:= DllCall("IsChild", "Ptr", Parent, "Ptr", WinHnd)
If (ErrorLevel <> 0) {
Msgbox, 64, Dll Call Error, % "Error Level: " . ErrorLevel
}
Return DllRes
}
WinWaitActive, ahk_group HotGrp
WinGet, ActHnd, ID, A
WinGetActiveTitle, ActTit
Loop {
WinWaitNotActive, ahk_id %ActHnd%
OldHnd:= ActHnd
OldTit:= ActTit
WinWaitActive, ahk_group HotGrp
WinGet, ActHnd, ID, A
WinGetActiveTitle, ActTit
If IsChildWindow(OldHnd, ActHnd) {
ChildIs:= ActHnd
} Else ChildIs:= 0
MsgBox, 64, % "Is " . (ChildIs = 0 ? "Not " : "") . "Child", % "Window [" . ActTit . "] Is " . (ChildIs = 0 ? "Not " : "") . "Child Of [" . OldTit . "]"
}