Valhalla Legends Forums Archive | Visual Basic Programming | Milliseconds

AuthorMessageTime
The-FooL
I seem to be missing something. How can I get the current milliseconds in VB?

I want to do something like Format(Time, "HH:MM:SS") or its equivalent.
April 25, 2004, 6:51 PM
Spht
[quote author=The-FooL link=board=31;threadid=6473;start=0#msg56871 date=1082919083]
I seem to be missing something. How can I get the current milliseconds in VB?

I want to do something like Format(Time, "HH:MM:SS") or its equivalent.
[/quote]

Call GetLocalTime() to get the current system time. It can be called like this:

[code]Dim lpSystemTime As SYSTEMTIME
GetLocalTime lpSystemTime[/code]

SYSTEMTIME contains the system's year, month, day, hour, etcetera. lpSystemTime.wMilliseconds will contain the system's milliseconds in time.

If you don't have API viewer:

[code]Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME)

Public Type SYSTEMTIME
wYear As Integer
wMonth As Integer
wDayOfWeek As Integer
wDay As Integer
wHour As Integer
wMinute As Integer
wSecond As Integer
wMilliseconds As Integer
End Type[/code]
April 25, 2004, 7:01 PM
The-FooL
Thanks alot!
April 26, 2004, 1:08 AM

Search