VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Sets the time on the local machine. Very usefull.

by Disk Junky (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Wed 28th February 2001
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Sets the time on the local machine. Very usefull.

API Declarations


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 Declare Function SetLocalTime Lib "kernel32.dll" (lpSystemTime As SystemTime) As Long

Rate Sets the time on the local machine. Very usefull.



Public Sub SetNewTime(NewHour As Integer, NewMinute As Integer, NewSecond As Integer)
' Set the system time with Hours, Minutes, Seconds
Dim SetTime As SystemTime
Dim RetVal As Long

SetTime.wHour = NewHour
SetTime.wMinute = NewMinute
SetTime.wSecond = NewSecond
SetTime.wMilliseconds = 0
SetTime.wDay = Day(Date)
SetTime.wMonth = Month(Date)
SetTime.wYear = Year(Date)

' Set time and date.
RetVal = SetLocalTime(SetTime)
End Sub


Download this snippet    Add to My Saved Code

Sets the time on the local machine. Very usefull. Comments

No comments have been posted about Sets the time on the local machine. Very usefull.. Why not be the first to post a comment about Sets the time on the local machine. Very usefull..

Post your comment

Subject:
Message:
0/1000 characters