Code : Tout sélectionner
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$titre = "Gestionnaire des tâches"
$width = 800
$height = 540
; fenetre
GUICreate($titre, $width, $height, -1, -1)
; table d'affichage
$tab = GUICtrlCreateTab(10, 10, $width - 20, $height - 20)
GUICtrlCreateTabItem($titre)
;;; liste des processus en cours
$gdt_listview = GUICtrlCreateListView(" Nom du processus | Chemin de l'Executable ", 20, 45, $width - 45, $height - 95)
$list = ProcessList()
for $i_gdt = 1 to $list[0][0]
;;; emplacement du processus
;;; listviewitem
GUICtrlCreateListViewItem( $list[$i_gdt][0] & "|" & _ProcessGetPath($list[$i_gdt][0]) , $gdt_listview)
next
GUICtrlCreateTabItem(""); fin de tabitem definition
GUISetState(@SW_SHOW) ; will display an empty dialog box
; Run the GUI until the dialog is closed
While 1
$msg = GUIGetMsg()
If $msg = $GUI_EVENT_CLOSE Then ExitLoop
WEnd
Func _ProcessGetPath($PID)
If IsString($PID) Then $PID = ProcessExists($PID)
$Path = DllStructCreate('char[1000]')
$dll = DllOpen('Kernel32.dll')
$handle = DllCall($dll, 'int', 'OpenProcess', 'dword', 0x0400 + 0x0010, 'int', 0, 'dword', $PID)
$ret = DllCall('Psapi.dll', 'long', 'GetModuleFileNameEx', 'long', $handle[0], 'int', 0, 'ptr', DllStructGetPtr($Path), 'long', DllStructGetSize($Path))
$ret = DllCall($dll, 'int', 'CloseHandle', 'hwnd', $handle[0])
DllClose($dll)
Return DllStructGetData($Path, 1)
EndFunc