双击注销button2按钮输入code:Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click LogoOff()'注销计算机 End Sub
双击重新启动按钮button3,输入code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Reboot() End Sub
双击关闭计算机按钮button1,输入code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click startTime = TimeOfDay If Not IsDate(TextBox1.Text) Then '用IsData函数判断输入的时间格式 MsgBox("你所输入的不是时间格式,!", , "错误") Else entTime = TimeValue(TextBox1.Text) End If Timer1.Enabled = True '启动定时器 Me.WindowState = System.Windows.Forms.FormWindowState.Minimized '最小化窗体 End Sub
如图3
双击timer1控件如图4
输入代码:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick xianzaiTime = TimeOfDay If RadioButton1.Checked Then If DateDiff(Microsoft.VisualBasic.DateInterval.Second, xianzaiTime, entTime) < 0 Then '用DateDiff函数判断是否到时间了 End If End If PowerOff() '关闭计算机 End Sub
Copyright 2001-2010, www.comprg.com.cn, All Rights Reserved 京ICP备14022230号-1,电话/传真:010-82561037 82561614 ,Mail:gaojian@comprg.com.cn
地址:北京市海淀区远大路20号宝蓝大厦E座704,邮编:100089