怎么实现电脑10钟无操作自动关机?

解决方案 »

  1.   

    使用命令就可以了shutdown -s -t 600
      

  2.   

    using System;class Program
    {
        static void Main()
        {
            shutdown();
        }
        public static void shutdown()
        {
            System.Diagnostics.Process.Start("shutdown.exe","-s -t 0");
        }
    }
      

  3.   

    或者  不用事件   用Timer 控制 触发
      

  4.   

    使用Timer控制时间。
    达到条件就关机。。
      

  5.   

    http://topic.csdn.net/t/20061211/11/5221453.html
    或者using System.Runtime.InteropServices;     [StructLayout(LayoutKind.Sequential)]
            struct LASTINPUTINFO
            {
                [MarshalAs(UnmanagedType.U4)]
                public int cbSize;
                [MarshalAs(UnmanagedType.U4)]
                public uint dwTime;
            }
            [DllImport("user32.dll")]
            static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);
            //得到无操作时间
            static long GetLastInputTime()
            {
                LASTINPUTINFO vLastInputInfo = new LASTINPUTINFO();
                vLastInputInfo.cbSize = Marshal.SizeOf(vLastInputInfo);
                if (!GetLastInputInfo(ref vLastInputInfo)) return 0;
                return Environment.TickCount - (long)vLastInputInfo.dwTime;
            } 然后用timer 检查 getlastinputtime
      

  6.   

    用定时器计时,然后创建进程调用cmd命令的shutdown就可以了
      

  7.   

    运行 里面 shutdown -s -t 600  600 就是10分钟
      

  8.   

    电脑里面开个作业 服务 到了点就调用 关闭电脑的 .dll
    我是这么理解的
      

  9.   

    话说要用全局钩子 监控消息 然后用计时 时间段内 无消息的话就调用 shutdown -s -t
    具体钩子监控 你看15L那个就好了..
    这个原理 和屏保是一样一样的..using   System; 
    using   System.Collections.Generic; 
    using   System.ComponentModel; 
    using   System.Data; 
    using   System.Drawing; 
    using   System.Text; 
    using   System.Windows.Forms; namespace   Mouse_Move 

            public   partial   class   Form1   :   Form 
            { 
                    public   Form1() 
                    { 
                            InitializeComponent(); 
                    }                 private   int   tick=0;                 protected   override   void   WndProc(ref   Message   msg) 
                    { 
                          base.WndProc(ref   msg); 
                          tick=Environment.TickCount; 
                    }                 private   void   timer1_Tick(object   sender,   EventArgs   e) 
                    { 
                            if(Environment.TickCount-tick> 2000)   this.Close();                         
                    } 
            } 
    }
      

  10.   

    System.Diagnostics.Process.Start("shutdown.exe","-s -t 0");
      

  11.   

    shutdown -f -s -t 600
    shutdown -a // cancel
      

  12.   

    1、使用全局钩子 监控 Keyboard Mouse 动作。
    2、注册一个Windows Service在要监视的机器,使用Timer 发现过了规定Time 使用 dos 命令或者别的方法都可以 关闭机器。
      

  13.   

    嗯,这个可以用全局的钩子监听键盘和鼠标的消息,触发的就采用timer去把机器关了