public struct Data { public ushort Year; public ushort Day; public ushort Month; public ushort Hour; public ushort Minute; public ushort Second; public ushort Millisecond; public ushort DayOfWeek; } class smth { [DllImport("kernel32.dll", EntryPoint = "GetSystemTime", SetLastError = true)] public extern static void Win32GetSystemTime(ref Data sysTime); [DllImport("kernel32.dll", EntryPoint = "SetSystemTime", SetLastError = true)] public extern static bool wSetSystemTime(ref Data sysTime); } public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { } private void button1_Click(object sender, EventArgs e) { Data modifica = new Data(); smth n = new smth(); modifica.Day = (ushort) (ushort)dateTimePicker1.Value.Day; modifica.luna=(ushort) dateTimePicker1.Value.Month; modifica.an = (ushort)dateTimePicker1.Value.Year; MessageBox.Show(dateTimePicker1.Value.ToString()); if( smth.wSetSystemTime(ref modifica)) throw new System.ComponentModel.Win32Exception(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)