Перейти из форума на сайт.

НовостиФайловые архивы
ПоискАктивные темыТоп лист
ПравилаКто в on-line?
Вход Забыли пароль? Первый раз на этом сайте? Регистрация
Компьютерный форум Ru.Board » Компьютеры » Программы » AutoIT (Часть 2)

Модерирует : gyra, Maz

Widok (01-06-2010 13:08): Лимит страниц. Продолжаем здесь.  Версия для печати • ПодписатьсяДобавить в закладки
На первую страницук этому сообщениюк последнему сообщению

   

ViSiToR



Silver Member
Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору

Код:
 
$aProc_List = _ProcessListEx()
$sProc_List = ""
 
For $i = 1 To $aProc_List[0][0]
    $sProc_List &= $aProc_List[$i][0] & ":" & $aProc_List[$i][1] & " [" & $aProc_List[$i][2] & "]" & @CRLF
Next
 
MsgBox(0, "Process by MrCreatoR ( _ProcessListEx())", $sProc_List)
;========================================================================
Func _ProcessListEx($sProcName = "")
    Local $aProcList
 
    If $sProcName <> "" Then
        $aProcList = ProcessList($sProcName)
    Else
        $aProcList = ProcessList()
    EndIf
 
    If
@error Then Return SetError(1, 0, '')
 
    Local $hKernel32_Dll = DllOpen('Kernel32.dll')
    Local $hPsapi_Dll = DllOpen('Psapi.dll')
    Local $aRet, $sFilePath, $tFilePath
    Local $aRet_List[$aProcList[0][0]+1][3]
 
    If $hKernel32_Dll = -1 Then Return SetError(2, 0, '')
 
    If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@SystemDir & '\Psapi.dll')
    If $hPsapi_Dll = -1 Then $hPsapi_Dll = DllOpen(@WindowsDir & '\Psapi.dll')
    If $hPsapi_Dll = -1 Then Return SetError(3, 0, '')
 
    For $i = 1 To UBound($aProcList) - 1
        $sFilePath = ""
        $tFilePath = DllStructCreate("wchar[300]")
 
        ; Открытие процесса
        $aRet = DllCall($hKernel32_Dll, 'ptr', 'OpenProcess', 'int', BitOR(0x400, 0x10), 'int', 0, 'int', $aProcList[$i][1])
 
        If $aRet[0] <> 0 Then
            ; Получение пути к файлу образа
            DllCall($hPsapi_Dll, "dword", "GetModuleFileNameExW", _
                "ptr", $aRet[0], "ptr", 0, "ptr", DllStructGetPtr($tFilePath), "dword", 300)
 
            ; Закрытие описателя и возврат значения
            DllCall($hKernel32_Dll, 'ptr', 'CloseHandle', 'ptr', $aRet[0])
 
            $sFilePath = DllStructGetData($tFilePath, 1)
        EndIf
 
        $aRet_List[0][0] += 1
 
        $aRet_List[$aRet_List[0][0]][0] = $aProcList[$i][0]  ;Process Name
        $aRet_List[$aRet_List[0][0]][1] = $aProcList[$i][1]  ;PID (Process ID)
        $aRet_List[$aRet_List[0][0]][2] = $sFilePath         ;Process File Path
 
        $tFilePath = 0
    Next
 
    DllClose($hKernel32_Dll)
    DllClose($hPsapi_Dll)
 
    ReDim $aRet_List[$aRet_List[0][0] + 1][3]
 
    If $aRet_List[0][0] < 1 Then Return SetError(4, 0, '')
    Return $aRet_List
EndFunc

Всего записей: 3251 | Зарегистр. 01-04-2006 | Отправлено: 00:23 27-05-2009
   

На первую страницук этому сообщениюк последнему сообщению

Компьютерный форум Ru.Board » Компьютеры » Программы » AutoIT (Часть 2)
Widok (01-06-2010 13:08): Лимит страниц. Продолжаем здесь.


Реклама на форуме Ru.Board.

Powered by Ikonboard "v2.1.7b" © 2000 Ikonboard.com
Modified by Ru.B0ard
© Ru.B0ard 2000-2024

BitCoin: 1NGG1chHtUvrtEqjeerQCKDMUi6S6CG4iC

Рейтинг.ru