CodeItBetter Programming Another VB Programming Blog

How to get windows up time

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
'System & API - How to get windows up time
Private Declare Function GetTickCount Lib "kernel32" () As Long
 
Private Sub Command1_Click()
    Debug.Print GetWinUpTime
End Sub
 
Private Function GetWinUpTime() As String
    Dim lSec As Long
    lSec = GetTickCount \ 1000
    GetWinUpTime = Format$((lSec \ 3600) \ 24, "00 Days ") _
                 & Format$((lSec \ 3600) Mod 24, "00 Hours ") _
                 & Format$((lSec Mod 3600) \ 60, "00 Minutes ") _
                 & Format$((lSec Mod 60), "00 Seconds ")
End Function
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


 

No trackbacks yet.