gzmickey 发表于 2010-2-16 19:36:18

获取系统启动后经过的毫秒数

#Include <WinAPIEx.au3>
_WinAPI_GetTickCount()

这个API使用方法是?

netegg 发表于 2010-2-16 20:51:49

不好意思,虽说是翻译的人,我也没仔细看,过几天琢磨出来再回答

white8889 发表于 2010-2-16 22:52:20

$Ret = DllCall("kernel32.dll", "long", "GetTickCount")
If IsArray($Ret) Then
      $day = ""
      $msec = StringRight("00" & mod($Ret, 1000), 3)
      $uptime = floor($Ret / 1000)
      $sec = StringRight("00" & mod($uptime, 60), 2)
      If $uptime >= 60 Then
                $uptime = floor($uptime / 60)
                $min = StringRight("00" & mod($uptime, 60), 2)
                If $uptime >= 60 Then
                        $uptime = floor($uptime / 60)
                        $hour = StringRight("00" & mod($uptime, 24), 2)
                        If $uptime >= 24 Then
                              $day = floor($uptime / 24) & "天"
                        EndIf
                EndIf
      EndIf
      MsgBox(0, "系统已启动:", $day & $hour & "小时" & $min & "分钟" & $sec & "秒" & $msec & "毫秒")
EndIf

供参考,_WinAPI_GetTickCount()返回的应该就是上面的$Ret

bing614 发表于 2010-2-17 02:38:33

#include <WinAPIEx.au3>
#include <Date.au3>
$timer = _WinAPI_GetTickCount()
Local $Hour, $Mins, $Secs
_TicksToTime($timer, $Hour, $Mins, $Secs)
MsgBox(0, "_WinAPI_GetTickCount", $Hour & "时" & $Mins & "分" & $Secs & "秒")
$timer2 = _Date_Time_GetTickCount()
Local $Hour2, $Mins2, $Secs2
_TicksToTime($timer2, $Hour2, $Mins2, $Secs2)
MsgBox(0, "_Date_Time_GetTickCount", $Hour2 & "时" & $Mins2 & "分" & $Secs2 & "秒")
页: [1]
查看完整版本: 获取系统启动后经过的毫秒数