Jump to content

Get process name from active window


spuuunit
 Share

Recommended Posts

Local $Actwin = WinGetHandle("[active]")
Local $PidActwin = WinGetProcess($Actwin)
Local $NamePidActwin = _Findpidname($PidActwin)

MsgBox(0, '', $NamePidActwin)

Func _Findpidname($Pid)
    Local $Processlist = ProcessList()
    For $i = 1 To $Processlist[0][0]
        If $Processlist[$i][1] = $Pid Then Return $Processlist[$i][0]
    Next
EndFunc   ;==>_Findpidname

Link to comment
Share on other sites

So

Local $Actwin = WinGetHandle("[active]")
Local $PidActwin = WinGetProcess($Actwin)
Local $NamePidActwin = _Findpidname($PidActwin)

MsgBox(0, '', $NamePidActwin)

Func _Findpidname($Pid)
    Local $Processlist = ProcessList()
    For $i = 1 To $Processlist[0][0]
        If $Processlist[$i][1] = $Pid Then Return $Processlist[$i][0]
    Next
EndFunc   ;==>_Findpidname

 

Sorry for the wait, but I've now tried your code, and it works verry well, thanks :). Thanks to you too John.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...