BugFix hatte mal eine schöne Funktion "_GetPathByPID" erstellt, die ihr für euren Taskmanager bestimmt gebrauchen könnt.
Habe mal ein Beispiel dazu geschrieben:
Spoiler anzeigen
#include <WindowsConstants.au3>
#include <ListViewConstants.au3>
#include <WinAPI.au3>
Global $iCount = 0, $aWinList = WinList()
$hGui = GUICreate('Task-Liste', 640, 240, -1, -1, BitOr($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX))
$hTaskList = GUICtrlCreateListView('Task|Pfad', 10, 10, 620, 220)
GUICtrlSendMsg($hTaskList, $LVM_SETCOLUMNWIDTH, 0, 270)
GUICtrlSendMsg($hTaskList, $LVM_SETCOLUMNWIDTH, 1, 340)
For $i = 1 To $aWinList[0][0]
If $aWinList[$i][0] <> '' And IsVisible($aWinList[$i][1]) Then
$sPath = _GetPathByPID(WinGetProcess($aWinList[$i][1]))
If Not @error Then GUICtrlCreateListViewItem($aWinList[$i][0] & '|' & $sPath, $hTaskList)
EndIf
Next
GUISetState()
Do
Until GUIGetMsg() = -3
Func IsVisible($handle)
Return BitAND(WinGetState($handle), 2)
EndFunc ;==>IsVisible
;===============================================================================
; Function Name: _GetPathByPID($PID=-1)
; Description:: Get full path of an running application by using PID
; Parameter(s): $PID - PID, if not set will used PID from active Window
; Requirement(s): #include <WinAPI.au3>
; Return Value(s): Success Full ApplicationPath
; Failure set @error 1 - process handle failed
; 2 - process image failed
; 3 - query dosdevice failed
; Author(s): BugFix ([email='bugfix@autoit.de'][/email])
;===============================================================================
Func _GetPathByPID($PID = -1)
If $PID = -1 Then $PID = WinGetProcess(WinGetTitle("[active]"))
$hProcess = _WinAPI_OpenProcess(0x00000400, True, $PID, True)
If Not $hProcess Then Return SetError(1, 0, 0)
Local $ret, $path, $DevicePath, $DeviceLetter, $strPath = DllStructCreate("char path[256]")
DllCall(@SystemDir & '\Psapi.dll', "uint64", "GetProcessImageFileNameA", _
"hwnd", $hProcess, "ptr", DllStructGetPtr($strPath), "int", 256)
If @error Then Return SetError(2, 0, 0)
$path = DllStructGetData($strPath, 'path')
$DevicePath = StringRegExp($path, "\\Device\\\w*", 1)
Local $lpTargetPath, $aDrive = DriveGetDrive("ALL")
For $i = 1 To UBound($aDrive) - 1
$ret = DllCall("kernel32.dll", "long", "QueryDosDeviceA", "str", $aDrive[$i], "str", $lpTargetPath, "long", 256)
If @error Then Return SetError(3, 0, 0)
If $ret[2] = $DevicePath[0] Then
$DeviceLetter = $aDrive[$i]
ExitLoop
EndIf
Next
DllCall("kernel32.dll", "long", "CloseHandle", "long", $hProcess)
Return StringReplace($path, $DevicePath[0], StringUpper($DeviceLetter))
EndFunc ;==>_GetPathByPID