紧凑的框架-如何通过C#为windows CE设置特定的时区

本文关键字:CE windows 设置 时区 框架 何通过 | 更新日期: 2023-09-27 17:59:27

大家好,我需要将windows CE 6的时区更改为(GMT+03:00)科威特,利雅得这是我的代码

[DllImport("coredll.dll", CharSet = CharSet.Auto)]
private static extern int GetTimeZoneInformation(out TimeZoneInformation lpTimeZoneInformation);

[DllImport("coredll.dll", CharSet = CharSet.Auto)]
private static extern bool SetTimeZoneInformation(ref TimeZoneInformation lpTimeZoneInformation);

[StructLayout(LayoutKind.Sequential)]
public struct SYSTEMTIME
{
    public int wYear;
    public int wMonth;
    public int wDayOfWeek;
    public int wDay;
    public int wHour;
    public int wMinute;
    public int wSecond;
    public int wMilliseconds;
}

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct TimeZoneInformation
{
    public int bias;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
    public string standardName;
    public SYSTEMTIME standardDate;
    public int standardBias;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
    public string daylightName;
    public SYSTEMTIME daylightDate;
    public int daylightBias;
}

如何使用此代码设置特定时区请任何人帮我。

紧凑的框架-如何通过C#为windows CE设置特定的时区

我通过添加带有此脚本的注册表文件找到了解决方案。

[HKEY_LOCAL_MACHINE'Time Zones]
        "Default"="Arab Standard Time"