一个小程序,运行它后可以设定一个时间值,当到达这个时间的时候自动重启windows。没其它方面了,除了运行后缩进系统托盘。万分感谢!只玖拾分了,有一定多给!

解决方案 »

  1.   

    (1)进入Visual Basic设计环境,新建一个工程项目Project1,在窗体中设置 
    按钮数组Command1(0)、Command1(1)和Command1(3).各个对象的属性如下: 
    form1: caption:启动工具 
    backcolor:&H00C0C0C0& 
    command1(0) caption:程序重新启动Windows 
    command1(1) caption:系统热启动 
    Command1(3) caption:退出 
    (2)代码设计。首先在窗体的通用代码区(General)内对所调用的 
    WindowsAPI函数进行声明如下: 
    Declare Function exitwindows Lib "User" (ByVal dwReturnCode As 
    Long, ByVal wReserved As Integer) As Integer 
    程序代码如下: 
    Sub Command1_Click (index As Integer) 
    Select Case index 
    Case 0 
    i = exitwindows(&H43, 0)’热启动 
    Case 1 
    i = exitwindows(&H42, 0)’重新启动Windows 
    Case 3 
    End ’退出 
    End Select 
    End Sub 
      

  2.   

    Private declare function exitwindows lib"user"(byval dwreturncode as long,byval wreserved as integer) as integerdim myval as integer
    private sub command1_click()
      myval=exitwindows(&H43,0)       '重启计算机
      '''myval=exitwindows(&H42,0)   '关闭计算机
    end sub
      

  3.   

    并增加Timer控件以控制重启的时间
      

  4.   

    还需要增加Timer控件以控制定时重启的情况
      

  5.   

    在窗口上放置Timer控件,将其Enabled属性设为True,Interval设置为1000(间隔时间)在Timer1_Timer中调用重启函数即可,如:If Time = "17:38:00" Then
         '调用重启函数
    End If