怎么获取某个进程名的运行时间?[已解决]
本帖最后由 lin6163 于 2010-10-9 17:43 编辑怎么获取某个进程名的运行时间
_WinAPI_GetProcessCreationTime
不会用
那个例子也是不对的 回复 1# lin6163
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $tFILETIME, $tSYSTEMTIME, $Id = ProcessExists('SciTE.exe');或进程PID
If $Id > 0 Then
$tFILETIME = _WinAPI_GetProcessCreationTime($Id)
$tSYSTEMTIME = _WinAPI_FileTimeToSystemTime(_WinAPI_FileTimeToLocalFileTime($tFILETIME))
ConsoleWrite('SciTE was run at: ' & _WinAPI_GetTimeFormat(0, $tSYSTEMTIME) & @CR)
EndIf
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $tFILETIME, $tSYSTEMTIME, $Id = ProcessExists('SciTE.exe')
If $Id > 0 Then
$tFILETIME = _WinAPI_GetTimeFormat(0,_WinAPI_FileTimeToSystemTime(_WinAPI_FileTimeToLocalFileTime(_WinAPI_GetProcessCreationTime($Id))))
MsgBox(0,'',$tFILETIME)
EndIf
liufenglg 发表于 2010-10-9 15:31 http://www.autoitx.com/images/common/back.gif
谢谢
这个比较好理解 本帖最后由 leon460 于 2011-6-22 23:08 编辑
回复 1# lin6163
我运行正常 ,不知楼主什么错误
贴出最新例子,帮助文件里面有的,自己再转换下时间吧
#Include <Date.au3>
#Include <WinAPIEx.au3>
Opt('MustDeclareVars', 1)
Global $aFT, $tFT, $tST, $ID = ProcessExists('SciTE.exe')
If $ID > 0 Then
$aFT = _WinAPI_GetProcessTimes($ID)
$tFT = _Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($aFT))
$tST = _Date_Time_FileTimeToSystemTime(DllStructGetPtr($tFT))
ConsoleWrite('SciTE was run at: ' & _WinAPI_GetTimeFormat(0, $tST) & @CR)
EndIf 學習學習~呵呵 {:face (396):} 挺好的,这个功能有用
页:
[1]