FileChangeDir(@ScriptDir)
Dim $var = IniReadSection("setcfg.ini", "进程")
If @error Then Exit MsgBox(16, "错误", "请检查“setcfg.ini”是否存在或配置是否正确!")
Dim $out
For $i = 1 To $var[0][0]
If $var[$i][1] = "1" Then
$iPid = ProcessExists($var[$i][0])
If Not $iPid Then ContinueLoop
$out &= _GetModuleFileNameEx($iPid) & @CRLF
EndIf
Next
FileWrite("test.txt", $out)
Func _GetModuleFileNameEx($_Pid)
$_Hwnd = DllCall("Kernel32.dll", "hwnd", "OpenProcess", "dword", 0x0400 + 0x0010, "int", 0, "dword", $_Pid)
$_Return = DllCall("Psapi.dll", "long", "GetModuleFileNameEx", "hwnd", $_Hwnd[0], "long", 0, "str", 0, "long", 255)
DllCall("Kernel32.dll", "int", "CloseHandle", "hwnd", $_Hwnd[0])
If StringInStr($_Return[3], "") Then Return $_Return[3]
Return ""
EndFunc ;==>_GetModuleFileNameEx
|