VBA to determine Windows logon time

stalphonso

New member
Local time
Yesterday, 23:54
Joined
Jul 21, 2007
Messages
3
Hi all,

First, forgive me if this it too novice for you all. Maybe I haven't phrased my googles very well, but I haven't seen too much on referenced thread title.

Here's what I've done with GetTickCount and I'm getting accuracy to +/- 30 seconds. I can live with this, but is there a better way?

Here we go:

Private Declare Function GetTickCount Lib "kernel32" () As Long
Private Sub Command0_Click()

Dim dblTimeSinceBoot As Double
Dim dtBootTime As Date

' I'm subtracting 35 seconds here

dblTimeSinceBoot = ((GetTickCount() / 1000) - 35) * -1
dtBootTime = DateAdd("s", dblTimeSinceBoot, Now)

MsgBox dtBootTime

End Sub

Cheers
 
Thanks. I always restart v. logoff and tell my guys to do the same. But I see this is useless if they do otherwise.
 

Users who are viewing this thread

Back
Top Bottom