D
darren
Hi i have alterd some code that changed the system time so it changes
the date could you olease tell me why it does not work
using System;
using System.Runtime.InteropServices;
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;
}
public class MyTimeAdjuster
{
[DllImport("kernel32.dll")]
public static extern bool GetSystemTime(ref
SystemTime systemTime);
[DllImport("kernel32.dll")]
public static extern bool SetSystemTime(ref
SystemTime systemTime);
void SetNewTime(short d, short m, short y)
{
SystemTime st = new SystemTime();
GetSystemTime(ref st);
st.wDay = d;
st.wMonth = m;
st.wYear = y;
SetSystemTime(ref st);
}
public static void Main(string[] args)
{
MyTimeAdjuster myTime = new
MyTimeAdjuster();
myTime.SetNewTime(1,12,2002);
}
}
the date could you olease tell me why it does not work
using System;
using System.Runtime.InteropServices;
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;
}
public class MyTimeAdjuster
{
[DllImport("kernel32.dll")]
public static extern bool GetSystemTime(ref
SystemTime systemTime);
[DllImport("kernel32.dll")]
public static extern bool SetSystemTime(ref
SystemTime systemTime);
void SetNewTime(short d, short m, short y)
{
SystemTime st = new SystemTime();
GetSystemTime(ref st);
st.wDay = d;
st.wMonth = m;
st.wYear = y;
SetSystemTime(ref st);
}
public static void Main(string[] args)
{
MyTimeAdjuster myTime = new
MyTimeAdjuster();
myTime.SetNewTime(1,12,2002);
}
}