Sign in to follow this  
Followers 0
death pax

PID to HWND

5 posts in this topic

Could anyone tell me how to get the HWND from a process id? Im sure its something really easy, but i have been looking through the help file for over an hour and havent figured it out ;) thx ^.^

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

i did edit the _processgetfirstwintitle a bit, because i already had the proper pid from a Run()

original _processgetfirstwintitle can be found at http://www.autoitscript.com/forum/index.ph...wtopic=5806&hl=

Func _ProcessGetFirstWinTitle($pid)
  local $testpid
  local $winlist
 ; Get window list
   $winList = WinList()
; Find which windows go with this process
   For $i = 0 To $winList[0][0] - 1
      $testPid = WinGetProcess($winList[$i][1])
      If $testPid = $pid Then
         Return $winList[$i][0]
      EndIf
   Next
   Return 0
EndFunc

$uHwnd=WinGetHandle(_ProcessGetFirstWinTitle($pId))
Edited by death pax

Share this post


Link to post
Share on other sites

Could anyone tell me how to get the HWND from a process id? Im sure its something really easy, but i have been looking through the help file for over an hour and havent figured it out ;) thx ^.^

I think it requires the latest beta but you can use the HWnd() function to get the HWND from a process id.

Share this post


Link to post
Share on other sites

Also remember that one PID can have loads of HWNDs

like explorer.exe has more then 50

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