关API进程的子进程问题!!!!!!!!!自已[已解决]
本帖最后由 lin6163 于 2010-10-7 13:29 编辑#NoTrayIcon
#Include <GuiListView.au3>
$ch = Win(ProcessExists(3024)) ;进程id 显示该进程的子进程
_ArrayDisplay($ch, "进程")
MsgBox("","",$ch) ;为什么会 显示为空
Func Win($PID = 0)
If Not $PID Then $PID = @AutoItPID
Local $hSnapshot = DllCall('kernel32.dll', 'ptr', 'CreateToolhelp32Snapshot', 'dword', 0x00000002, 'dword', 0)
If (@error) or (Not $hSnapshot) Then
Return SetError(1, 0, 0)
EndIf
Local $tPROCESSENTRY32 = DllStructCreate('dword Size;dword Usage;dword ProcessID;ulong_ptr DefaultHeapID;dword ModuleID;dword Threads;dword ParentProcessID;long PriClassBase;dword Flags;wchar ExeFile')
Local $pPROCESSENTRY32 = DllStructGetPtr($tPROCESSENTRY32)
Local $Ret, $Result, $i = 0
$hSnapshot = $hSnapshot
DllStructSetData($tPROCESSENTRY32, 'Size', DllStructGetSize($tPROCESSENTRY32))
$Ret = DllCall('kernel32.dll', 'int', 'Process32FirstW', 'ptr', $hSnapshot, 'ptr', $pPROCESSENTRY32)
While (Not @error) And ($Ret)
If DllStructGetData($tPROCESSENTRY32, 'ParentProcessID') = $PID Then
ReDim $Result[$i + 1]
$Result[$i] = DllStructGetData($tPROCESSENTRY32, 'ProcessID')
$Result[$i] = DllStructGetData($tPROCESSENTRY32, 'ExeFile')
$i += 1
EndIf
$Ret = DllCall('kernel32.dll', 'int', 'Process32NextW', 'ptr', $hSnapshot, 'ptr', $pPROCESSENTRY32)
WEnd
DllCall("kernel32.dll", 'int', 'CloseHandle', "hwnd", $hSnapshot)
Return $Result
EndFunc 路过知道的说下 回复 2# lin6163
$ch 为一个数组吧,数组的显示方式,_arraydisplay才行,用msgbox 显示你只有写下标了
页:
[1]