您的位置:首页 > 编程语言 > C#

C#修改PocketPC的时间

2007-06-21 22:46 134 查看

using System.Runtime.InteropServices;




[DllImport("coredll.dll", SetLastError=true)]


public static extern int SetLocalTime (ref SystemTime lpSystemTime);






public struct SystemTime




...{


public short wYear;


public short wMonth;


public short wDayOfWeek;


public short wDay;


public short wHour;


public short wMinute;


public short wSecond;


public short wMilliseconds;


}






private void Form1_Load(object sender, EventArgs e)




...{


SystemTime systNew = new SystemTime();




// 设置属性


systNew.wDay = 1;


systNew.wMonth = 1;


systNew.wYear = 2004;


systNew.wHour = 9;


systNew.wMinute = 0;


systNew.wSecond = 0;




// 调用API,更新系统时间


SetLocalTime(ref systNew);


}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: