Wednesday, April 29, 2009

Get System Time

'Get System Time



Private Declare Sub GetSystemTime
Lib "kernel32" _

(lpSystemTime As SYSTEMTIME)



Private 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



Private Sub Form_Load()

Dim SysTime As SYSTEMTIME

'Set the graphical mode to persistent

Me.AutoRedraw = True

'Get the system time

GetSystemTime SysTime

'Print it to the form

Me.Print "The Local Date is:" & SysTime.wMonth & "-" & _

SysTime.wDay & "-" & SysTime.wYear

Me.Print "The Local Time is:" & SysTime.wHour & ":" & _

SysTime.wMinute & ":" & SysTime.wSecond

End Sub

No comments:

Post a Comment