Joe_Shen
asked on
Disable daylight savings time
Hi,
Any one knows how to disable or uncheck "Automatically adjust clock for daylight saving changes" in Time Zone settings?
Thanks a lot.
Joe
Any one knows how to disable or uncheck "Automatically adjust clock for daylight saving changes" in Time Zone settings?
Thanks a lot.
Joe
ASKER
Thanks a lot, Mugman.
Sorry for reply late since I was tighted up with something else.
I am just VB beginner, could you email me some codes of how to get this done? my email is:
zqshen@juno.com
Again, Thank you for your help.
Joe
Sorry for reply late since I was tighted up with something else.
I am just VB beginner, could you email me some codes of how to get this done? my email is:
zqshen@juno.com
Again, Thank you for your help.
Joe
Joe, I'll post some code here along with a link to the need class module just so this question can be PAQ'ed for others that might want to know this. I'll zip the sample project and email it to you.
Mugman
Mugman
To create a project that will test whether automatic daylight savings is enabled or disabled, first download the class module from
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=57232&lngWId=1
Create a project, add a form and two command buttons using the default names. Add the following code to Form1:
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ------
Dim reg As clsRegistryAccess
Private Sub Form_Load()
'create the object
Set reg = New clsRegistryAccess
End Sub
Private Sub Command1_Click()
Dim DoesExist As Boolean
Dim KeysValue As Long
'determine if the key even exist
DoesExist = reg.ValueExists("HKEY_LOCA L_MACHINE\ SYSTEM\Cur rentContro lSet\Contr ol\TimeZon eInformati on", "DisableAutoDaylightTimeSe t")
If DoesExist = False Then
'if the keyvalue does not even exist, = false, then daylightsavings is on by default
MsgBox "This system will automatically adjust for daylightsavings"
Else
'if key does exist, lets read it and check it's value
KeysValue = reg.ReadDWORD("HKEY_LOCAL_ MACHINE\SY STEM\Curre ntControlS et\Control \TimeZoneI nformation ", "DisableAutoDaylightTimeSe t")
If KeysValue = 0 Then
MsgBox "daylightsavings is enabled"
ElseIf KeysValue = 1 Then
MsgBox "daylightsavings is disabled"
End If
End If
End Sub
Private Sub Command2_Click()
'if the key exist, we'll rewrite over it or if not, we'll create and set it
reg.CreateKeyIfDoesntExist s = True
reg.WriteDWORD "HKEY_LOCAL_MACHINE\SYSTEM \CurrentCo ntrolSet\C ontrol\Tim eZoneInfor mation", "DisableAutoDaylightTimeSe t", 1
End Sub
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?txtCodeId=57232&lngWId=1
Create a project, add a form and two command buttons using the default names. Add the following code to Form1:
'-------------------------
Dim reg As clsRegistryAccess
Private Sub Form_Load()
'create the object
Set reg = New clsRegistryAccess
End Sub
Private Sub Command1_Click()
Dim DoesExist As Boolean
Dim KeysValue As Long
'determine if the key even exist
DoesExist = reg.ValueExists("HKEY_LOCA
If DoesExist = False Then
'if the keyvalue does not even exist, = false, then daylightsavings is on by default
MsgBox "This system will automatically adjust for daylightsavings"
Else
'if key does exist, lets read it and check it's value
KeysValue = reg.ReadDWORD("HKEY_LOCAL_
If KeysValue = 0 Then
MsgBox "daylightsavings is enabled"
ElseIf KeysValue = 1 Then
MsgBox "daylightsavings is disabled"
End If
End If
End Sub
Private Sub Command2_Click()
'if the key exist, we'll rewrite over it or if not, we'll create and set it
reg.CreateKeyIfDoesntExist
reg.WriteDWORD "HKEY_LOCAL_MACHINE\SYSTEM
End Sub
and if it is Enabled, click Command2 and it will create the appropriate key and disable it.....
Mugman
Mugman
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, Mugman
Your codes work perfectly. Sorry for late reply again.
Wish you the best.
Joe
Your codes work perfectly. Sorry for late reply again.
Wish you the best.
Joe
You need to change it in your registry. The key that needs to be changed is outlined here:
http://www.winguides.com/registry/display.php/1283/
I don't know how much programming experiance you have, if you need a little help in registry writes, just ask...
Mugman