计算本程序运行时间
如何算出 本程序的运行时间。。。?又何好方法呢? 搜搜,有人问过的。 timerinittimerdiff 获取进程启动时间,在与当前系统时间相减就能得到进程运行时间。
获取进程启动时间代码:#Include <Date.au3>
$Pid=ProcessExists("Explorer.exe")
MsgBox(0,"","'Explorer.exe' 进程启动时间: " & _GetProcessTimes($Pid))
Func _GetProcessTimes($_PID)
$_PID=ProcessExists($_PID)
If $_PID=0 Then Return ""
$_Return=DllCall("Kernel32.dll","hwnd","OpenProcess","dword",0x0400,"int",False,"dword",$_PID)
$_time1=DllStructCreate($tagFILETIME)
$_time2=DllStructCreate($tagFILETIME)
$_time3=DllStructCreate($tagFILETIME)
$_time4=DllStructCreate($tagFILETIME)
$_Return=DllCall("Kernel32.dll","int","GetProcessTimes","hwnd",$_Return,"ptr",DllStructGetPtr($_time1),"ptr",DllStructGetPtr($_time2),"ptr",DllStructGetPtr($_time3),"ptr",DllStructGetPtr($_time4))
DllCall("Kernel32.dll","int","CloseHandle","hwnd",$_Return)
$_LocalFileTime=_Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($_time1))
$aDate=_Date_Time_FileTimeToArray($_LocalFileTime)
Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $aDate, $aDate, $aDate, $aDate, $aDate, $aDate)
EndFunc
页:
[1]