2012-04-13 8 views
2

Es ist mir gelungen, die Zeitzone und die Sommerzeit in Windows mit SetTimeZoneInformation zu ändern, aber selbst wenn wMonth auf 0 gesetzt wird, wird das Kontrollkästchen in datetime.cpl überprüft.Wie deaktiviere ich "Adjust daylight ..." mit SetTimeZoneInformation?

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) 

Wie kann ich das ändern? Muss ich den Registrierungsschlüssel DisableAutoDaylightTimeSet auch manuell erstellen/löschen?

Dank

Antwort

0

erstellen/löschen Sie den Registrierungsschlüssel manuell die Art und Weise ...

zu tun ist,