• Welcome to Valhalla Legends Archive.
 

Milliseconds

Started by The-FooL, April 25, 2004, 01:51 PM

Previous topic - Next topic

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.

Spht

#1
Quote from: The-FooL on April 25, 2004, 01:51 PM
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.

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

Dim lpSystemTime As SYSTEMTIME
GetLocalTime lpSystemTime


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:

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

The-FooL