Connecting Tech Pros Worldwide Forums | Help | Site Map

How to force Daylight Savings change

Vertical Technology Group
Guest
 
Posts: n/a
#1: Jul 21 '05
If I open the Date and Time Properties dialog and check/uncheck the
"Automatically adjust clock for daylight savings changes" checkbox, my system
clock moves forward and back an hour as I would expect. How can I get the
same effect programmatically???

My app currently changes the "DisableAutoDaylightTimeSet" value in the
Registry as it should, but it appears that I also need to notify Windows that
the value has changed. I've tried all of the following WIN32 options to
trigger the change permanently, but nothing seems to work:

(1) SYSTEMTIME now; GetLocalTime(&now); SetLocalTime(&now);
(2) SendMessage(HWND_TOPMOST, WM_TIMECHANGE, 0L, 0L);
(3) SendMessageTimeout(HWND_BROADCAST, WM_SETTINGCHANGE, 0L, 0L,
SMTO_NORMAL, 5000, NULL);

What does the dialog box do to force this behavior? Is there a .Net
alternative that works?

Thanks.

Jay


Closed Thread


Similar .NET Framework bytes