找回密码
 加入
搜索
查看: 1490|回复: 3

计算本程序运行时间

[复制链接]
发表于 2009-12-25 21:11:18 | 显示全部楼层 |阅读模式
如何算出 本程序的运行时间。。。?又何好方法呢?
发表于 2009-12-25 21:15:50 | 显示全部楼层
搜搜,有人问过的。
发表于 2009-12-25 21:37:17 | 显示全部楼层
timerinit
timerdiff
发表于 2009-12-27 02:58:13 | 显示全部楼层
获取进程启动时间,在与当前系统时间相减就能得到进程运行时间。
获取进程启动时间代码:
#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[0],"ptr",DllStructGetPtr($_time1),"ptr",DllStructGetPtr($_time2),"ptr",DllStructGetPtr($_time3),"ptr",DllStructGetPtr($_time4))
        DllCall("Kernel32.dll","int","CloseHandle","hwnd",$_Return[0])
        $_LocalFileTime=_Date_Time_FileTimeToLocalFileTime(DllStructGetPtr($_time1))
        $aDate=_Date_Time_FileTimeToArray($_LocalFileTime)
        Return StringFormat("%04d/%02d/%02d %02d:%02d:%02d", $aDate[2], $aDate[0], $aDate[1], $aDate[3], $aDate[4], $aDate[5])
EndFunc
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-9-22 15:42 , Processed in 0.078426 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表