如何取消选中“调整日光”.“,与设置时区信息

本文关键字:调整日光 设置 信息 时区 日光 调整 取消 何取消 | 更新日期: 2023-09-27 18:30:56

我成功地使用SetTimeZoneInformation更改了Windows中的时区和夏令时,但即使将wMonth设置为0,也会选中datetime.cpl中的复选框。

TIME_ZONE_INFORMATION actual = new TIME_ZONE_INFORMATION();
NativeMethods.GetTimeZoneInformation(out actual);
// Datetime.cpl put the standard time in daylight time and add the regkey
// When executing this -> Regkey is not set automatically
actual.DaylightBias = actual.StandardBias;
actual.DaylightDate = actual.StandardDate;
actual.DaylightName = actual.StandardName;
RunWin32Method(() => NativeMethods.SetTimeZoneInformation(ref newZone));
NativeMethods.SendMessageTimeout(NativeMethods.HWND_BROADCAST, NativeMethods.WM_SETTING_CHANGE, IntPtr.Zero, IntPtr.Zero, 0x00, 1000, out ptr)
// MSDN said
// When executing this -> Regkey is not set automatically
actual.StandardDate.Month = 0;
RunWin32Method(() => NativeMethods.SetTimeZoneInformation(ref newZone));
NativeMethods.SendMessageTimeout(NativeMethods.HWND_BROADCAST, NativeMethods.WM_SETTING_CHANGE, IntPtr.Zero, IntPtr.Zero, 0x00, 1000, out ptr)

我该如何更改此设置?我还需要手动创建/删除DisableAutoDaylightTimeSet注册表项吗?

谢谢

如何取消选中“调整日光”.“,与设置时区信息

手动创建/删除注册表项是

...