找回密码
 加入
搜索
查看: 2546|回复: 2

[AU3基础] 关API进程的子进程问题!!!!!!!!!自已[已解决]

[复制链接]
发表于 2010-9-26 09:05:41 | 显示全部楼层 |阅读模式
本帖最后由 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[0]) 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[260]')
    Local $pPROCESSENTRY32 = DllStructGetPtr($tPROCESSENTRY32)
    Local $Ret, $Result[1][2], $i = 0
    $hSnapshot = $hSnapshot[0]
    DllStructSetData($tPROCESSENTRY32, 'Size', DllStructGetSize($tPROCESSENTRY32))
    $Ret = DllCall('kernel32.dll', 'int', 'Process32FirstW', 'ptr', $hSnapshot, 'ptr', $pPROCESSENTRY32)
    While (Not @error) And ($Ret[0])
        If DllStructGetData($tPROCESSENTRY32, 'ParentProcessID') = $PID Then
            ReDim $Result[$i + 1][2]
            $Result[$i][0] = DllStructGetData($tPROCESSENTRY32, 'ProcessID')
            $Result[$i][1] = 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
 楼主| 发表于 2010-9-26 10:58:10 | 显示全部楼层
路过知道的说下
发表于 2011-6-20 23:15:39 | 显示全部楼层
回复 2# lin6163

$ch 为一个数组吧,数组的显示方式,_arraydisplay  才行,用msgbox 显示你只有写下标了
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-10-2 01:37 , Processed in 0.085510 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表