zoukankan      html  css  js  c++  java
  • C#修改电脑时间

    using System;
    using System.Collections.Generic;
    using System.Text;
    using System.Runtime.InteropServices;
    namespace settime
    {
        class Program
        {
            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;
            }

            [DllImport("kernel32.dll", SetLastError = true)]
            public static extern int SetLocalTime(ref SystemTime lpSystemTime);

            static void Main(string[] args)
            {
                DateTime newDate = DateTime.Now.AddDays(1);
                SystemTime sysNew = new SystemTime();
                sysNew.wDay = (short)newDate.Day;
                sysNew.wMonth = (short)newDate.Month;
                sysNew.wYear = (short)newDate.Year;
                sysNew.wHour = 8;
                sysNew.wMinute = 59;
                sysNew.wSecond = 55;
                SetLocalTime(ref sysNew);
            }
        }
    }
  • 相关阅读:
    Metro-Ural119递推
    Flags-Ural1225简单递推
    Candies-POJ3159差分约束
    Is the Information Reliable? -POJ2983差分约束
    MPI Maelstrom
    Codeforces Round #342 (Div. 2)-B. War of the Corporations
    Codeforces Round #342 (Div. 2)-A. Guest From the Past
    Vim升华之树形目录插件NERDTree安装图解
    The Same Game-POJ1027模拟
    Flesch Reading Ease -POJ3371模拟
  • 原文地址:https://www.cnblogs.com/barrysgy/p/2734015.html
Copyright © 2011-2022 走看看