Код реализует программную, быструю смену даты и времени на вашем компьютере.
public struct SystemTime
{
public ushort Year;
public ushort Month;
public ushort DayOfWeek;
public ushort Day;
public ushort Hour;
public ushort Minute;
public ushort Second;
public ushort Millisecond;
};
[DllImport("kernel32.dll", EntryPoint = "GetSystemTime", SetLastError = true)]
public extern static void Win32GetSystemTime(ref SystemTime sysTime);
[DllImport("kernel32.dll", EntryPoint = "SetSystemTime", SetLastError = true)]
public extern static bool Win32SetSystemTime(ref SystemTime sysTime);
private void button1_Click(object sender, EventArgs e)
{
SystemTime updatedTime = new SystemTime();
updatedTime.Year = (ushort)2011;//Год
updatedTime.Month = (ushort)7;//Минуты
updatedTime.Day = (ushort)11;//День
updatedTime.Hour = (ushort)15; //Час
updatedTime.Minute = (ushort)0;//Минуты
updatedTime.Second = (ushort)0;//Секунды
Win32SetSystemTime(ref updatedTime);
SystemTime currTime = new SystemTime();
Win32GetSystemTime(ref currTime);
}
Ссылка на исходник: Rusfolder.net
0.00 (0%) 0 votes










