Prozesslaufzeit auslesen?

  • Hi zusammen,

    Kann man per AutoIT die Laufzeit eines Prozesses auslesen? Also ich will wissen, wie lange ein bestimmter Prozess ohne unterbrechung ausgeführt wird...

    Ihr könnt mir da bestimmt helfen ;)

    mfg

    *mow*

  • Oder meinst du das?

    Spoiler anzeigen
    [autoit]

    #include<Date.au3>
    #include<WinAPI.au3>
    #include<Constants.au3>

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

    $hProcess = _WinAPI_OpenProcess($PROCESS_QUERY_INFORMATION, False, @AutoItPID)
    $tCreationTime = DllStructCreate($tagFILETIME)
    _WinAPI_GetProcessTimes($hProcess, DllStructGetPtr($tCreationTime))
    _WinAPI_CloseHandle($hProcess)

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

    $tCreationTimeLocal = _Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($tCreationTime))
    $sCreationTime = _Date_Time_FileTimeToStr($tCreationTimeLocal)

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

    MsgBox(0, '', $sCreationTime)

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

    Func _WinAPI_GetProcessTimes($hProcess, $lpCreationTime, $lpExitTime=0, $lpKernelTime=0, $lpUserTime=0)
    ;Author: Prog@ndy
    Local $EmptyTime = DllStructCreate($tagFILETIME)
    If Not IsPtr($lpCreationTime) Then $lpCreationTime = DllStructGetPtr($EmptyTime)
    If Not IsPtr($lpExitTime) Then $lpExitTime = DllStructGetPtr($EmptyTime)
    If Not IsPtr($lpKernelTime) Then $lpKernelTime = DllStructGetPtr($EmptyTime)
    If Not IsPtr($lpUserTime) Then $lpUserTime = DllStructGetPtr($EmptyTime)
    Local $aResult = DllCall('Kernel32.dll', 'int', 'GetProcessTimes', 'ptr', $hProcess, 'ptr', $lpCreationTime, 'ptr', $lpExitTime, 'ptr', $lpKernelTime, 'ptr', $lpUserTime)
    If @error Then Return SetError(1,0,0)
    Return SetError($aResult[0]=0, 0, $aResult[0])
    EndFunc

    [/autoit]