I have a program which could have several instances open, all of which would appear the same through winmatch of titles/classes etc.
Is there a away to get a handle for the window when launching it via it's PID?
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)