Prozesshandle?

  • Nur mal eine kleine Frage:Wie kann man in AutoIt an ein Handle eines Prozesses kommen?Oder ist die PID das Handle?Das würde mich mal ganz allgemein interessieren

    Einmal editiert, zuletzt von masterplc (23. August 2013 um 22:39)

  • Sucht du diese Funktionen?

    [autoit]

    WinGetHandle
    ProcessExists
    ProcessList

    [/autoit]


    ;)

    MfG

    There's a joke that C has the speed and efficieny of assembly language combined with readability of....assembly language. In other words, it's just a glorified assembly language. - Teh Interwebz

    C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, you blow off your whole leg. - Bjarne Stroustrup
    Genie zu sein, bedeutet für mich, alles zu tun, was ich will. - Klaus Kinski

  • [autoit]

    ;~ 1 = Fenster existiert.
    ;~ 2 = Fenster ist sichtbar.
    ;~ 4 = Fenster ist freigegeben.
    ;~ 8 = Fenster ist aktiv.
    ;~ 16 = Fenster ist minimiert.
    ;~ 32 = Fenster ist maximiert.
    #include <Array.au3>
    #include <Process.au3>
    Global $list = ProcessList()

    [/autoit][autoit][/autoit][autoit]

    _ArrayDisplay($list,"test")

    [/autoit][autoit][/autoit][autoit]

    Func _GetProcessPath($GPPpid)
    $colItems = ""
    $strComputer = "localhost"

    [/autoit][autoit][/autoit][autoit]

    $objWMIService = ObjGet("winmgmts:\\localhost\root\CIMV2")
    $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Process WHERE processid = ' & $GPPpid, "WQL", 0x10 + 0x20)

    [/autoit][autoit][/autoit][autoit]

    If IsObj($colItems) Then
    For $objItem In $colItems
    Return $objItem.ExecutablePath
    Next
    Else
    Return ""
    EndIf
    EndFunc ;==>_GetProcessPath

    [/autoit][autoit][/autoit][autoit]

    Func _WinGetByPID($iPID, $nArray = 1)
    If IsString($iPID) Then $iPID = ProcessExists($iPID)
    Local $aWList = WinList(), $sHold
    For $iCC = 1 To $aWList[0][0]
    If WinGetProcess($aWList[$iCC][1]) = $iPID And _
    BitAND(WinGetState($aWList[$iCC][1]), 2) Then
    If $nArray Then Return $aWList[$iCC][0]
    $sHold &= $aWList[$iCC][0] & Chr(1)
    EndIf
    Next
    If $sHold Then Return StringSplit(StringTrimRight($sHold, 1), Chr(1))
    Return SetError(1, 0, 0)
    EndFunc ;==>_WinGetByPID

    [/autoit]