Sign in to follow this  
Followers 0
E1M1

how to get win name from PID

4 posts in this topic

I know that pid is X now how I get it's window name? for example notepad's pid is 1000 but it don't know it's window title, now how I get window title if i know only that pid is 1000?


edited

Share this post


Link to post
Share on other sites



Use WinList and then WinGetProcess in a loop!

GUICreate ("A success!!")

$ret = _ProcessGetWindow (@AutoitPID)

MsgBox (0, "The test was...", $ret)

Func _ProcessGetWindow ($nPid)
   Local $aList = WinList ()

   For $i = 1 to $aList[0][0]
      If winGetProcess ($aList[$i][1]) = $nPid Then Return $aList[$i][0]
   Next
   Return SetError (1, 0, "")
EndFunc ; ==> _ProcessGetWindow

Here we know that the GUI's PID will be autoit, so we test for that.

Mat

Share this post


Link to post
Share on other sites

Or use _ProcessGetName...

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0