码迷,mamicode.com
首页 > Windows程序 > 详细

c# 编程修改 wince 系统时间

时间:2015-01-19 10:39:41      阅读:223      评论:0      收藏:0      [点我收藏+]

标签:

        [StructLayout(LayoutKind.Sequential)]
        public struct SYSTEMTIME
        {
            public ushort wYear;
            public ushort wMonth;
            public ushort wDayOfWeek;
            public ushort wDay;
            public ushort wHour;
            public ushort wMinute;
            public ushort wSecond;
            public ushort wMilliseconds;
        }
        [DllImport("coredll.dll")]
        private static extern bool SetLocalTime(ref SYSTEMTIME lpSystemTime);
        [DllImport("coredll.dll")]
        private static extern bool GetLocalTime(ref SYSTEMTIME lpSystemTime);     

            SYSTEMTIME lpTime =  new SYSTEMTIME (); 
            lpTime.wYear =  Convert.ToUInt16(N.Text); 
            lpTime.wMonth = Convert.ToUInt16(Y.Text); 
            lpTime.wDay = Convert.ToUInt16(R.Text); 
            lpTime.wHour = Convert.ToUInt16(S.Text); 
            lpTime.wMinute = Convert.ToUInt16(F.Text); 
            lpTime.wSecond = Convert.ToUInt16(M.Text);
            SetLocalTime(ref lpTime);

  

c# 编程修改 wince 系统时间

标签:

原文地址:http://www.cnblogs.com/FuYan/p/4233077.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!