_WindowFromProcessId

Gets the handle of the first window or window with title keyword of given process id

#include "Window, Screen, Mouse and Control.au3"
_WindowFromProcessId( $ProcessId [, $cTitleKeyword = "" [, $EnabledOnly = True ]] )

parameters

$ProcessId Id of process
$cTitleKeyword Keyword to match the window to be activated, usually the main window
$EnabledOnly True = (default) only an enabled window

return value

window handle First found window handle or null pointer if a window couldn't be found

related

_ProcessGetProcessId

example

$hWindow = _WindowFromProcessId(3519) ; gets first window handle of process 3519
$hWindow = _WindowFromProcessId(6581,"paint") ; gets main window handle of mspaint of process 6581 by giving proper keyword "paint"