Only gets the handle for the FIRST visible window. As was pointed out earlier, a process can and often does have multiple windows. Try it this way: #include <Array.au3> ; ... ; Returns an array of all Windows associated with a given process Func WinHandFromPID($pid, $winTitle = "", $timeout = 8) Local $secs = TimerInit() Do $wins = WinList($winTitle) For $i = UBound($wins) - 1 To 1 Step -1 If (WinGetProcess($wins[$i][1]) <> $pid) Or (BitAND(WinGetState($wins[$i][1]), 2)