【问题标题】:How to set a specific timezone for windows CE By C#如何通过 C# 为 Windows CE 设置特定时区
【发布时间】:2015-06-24 20:21:38
【问题描述】:

大家好,我需要将 Windows CE 6 的时区更改为 “(格林威治标准时间 +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# compact-framework windows-ce


【解决方案1】:

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

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2022-11-30
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-10-20
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多