WinCE下,C#更改wince操作系统的时间
来源:互联网 发布:淘宝店铺导航条字体 编辑:程序博客网 时间:2024/05/16 00:58
最近有一个WINCE下的小项目,有要设置系统时间的功能
代码如下:
using System.Runtime.InteropServices;[DllImport("coredll.dll")]private static extern bool SetLocalTime(ref SYSTEMTIME lpSystemTime); [StructLayout(LayoutKind.Sequential)]private 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;}private void setTime(){try{// 自己获取到的时间, 如 DateTime.Now.Year等string ttstr = "2013-06-03-10-26-31";string remoteTime = ttstr.Substring(0, 4) + "-" + ttstr.Substring(5, 2) + "-" + ttstr.Substring(8, 2) + "-" + ttstr.Substring(11, 2) + "-" + ttstr.Substring(14, 2) + "-" + ttstr.Substring(17, 2) ; //DateTime.Parse( // ws.getTime(); //2013-06-03-10-26-31string[] str = remoteTime.Split('-');SYSTEMTIME systNew = new SYSTEMTIME();systNew.wDay = Convert.ToUInt16(str[2]);systNew.wMonth = Convert.ToUInt16(str[1]);systNew.wYear = Convert.ToUInt16(str[0]);systNew.wHour = Convert.ToUInt16(str[3]);systNew.wMinute = Convert.ToUInt16(str[4]);systNew.wSecond = Convert.ToUInt16(str[5]);SetLocalTime(ref systNew);}catch (Exception ex){MessageBox.Show(ex.Message);}}
阅读全文
0 0
- WinCE下,C#更改wince操作系统的时间
- C#更改wince的时间
- WINCE下C#画图
- C#调节WINCE下textBox的大小
- wince下pppoe的实现,c#
- wince下, c# 自定义的 MessageBox 控件
- winCE下全屏的C#代码
- WinCE下的C#开发,备忘录
- winCE下实现全屏的C#代码
- wince下全屏的C#代码、wince下隐藏任务栏C#源码
- WinCE操作系统的基本体系结构
- WinCE操作系统的基本体系结构
- WINCE 下C#全屏显示
- WINCE下的BLENDFUNCTION
- Wince下的GDI+
- WinCE下的快捷方式
- wince下的快捷方式
- wince下的JSON
- Java集合分析(1):Iterator(迭代器)
- android 空格占位符
- 网络
- 从request获取各种路径总结 request.getRealPath("url")
- javaScript判断数据类型以及typeof和intanceof的差别
- WinCE下,C#更改wince操作系统的时间
- ubuntu12.04LTS安装以及卸载 QT4.8.6和QT creator2.5.2
- Dialog显示引起的问题 Activity has leaked window DecorView@5704632[] that was originally added here
- centos 6.5 单网卡多IP配置
- Focal Loss for Dense Object Detection
- Leetcode 513. Find Bottom Left Tree Value
- 学校允许自己提前用知网查重吗?
- .9图制作
- mvn命令生成项目