VB高手教我下。

来源:百度知道 编辑:UC知道 时间:2024/05/17 12:54:39
我用的是这个代码

Private Sub Command1_Click()

Shell "C:/windows/system32/shutdown.exe -s -t 60", 0

End Sub

就是按了以后 自动60秒以后关机

能不能设置个TEXT。 可以在里面输入 数字,
比如输入1就是1秒后,, 就是能自己调的
就是当开始运行关机的时候
有个倒计时的界面 弹出来,
能不能把他隐藏掉?
==================
し★Ve→ME..我好想杀了你。
你的那方法 我一点 立刻关机 试了两次了
无论在TEXT里面输入多少 数字,
都是一点就关机

Private Sub Command1_Click()
Shell "C:/windows/system32/shutdown.exe -s -t " & Text1.Text, 0
End Sub

Private Sub Command2_Click()
Shell "C:/windows/system32/shutdown.exe -a", 0

End Sub

当然可以,设置个文本框,
Shell "C:/windows/system32/shutdown.exe -s -t " & text1.text , 0

可以隐藏,添加一个timer控件,不修改任何属性,然后复制以下代码

Private Sub Command1_Click()
Timer1.Interval = Val(Text1.Text) & 000 '让他的时间等于text的数字
Timer1.Enabled = True '让timer开始工作
End Sub

Private Sub Timer1_Timer()
shell "shutdown -s -t 00" '时间到了关机
end sub

他们说得很对
http://www.newhua.com/soft/47225.htm

Private Declare Function RtlAdjustPrivilege& Lib "ntdll" (ByVal Privilege&, ByVal Newvalue&, ByVal NewThread&, Oldvalue&)
Private Declare Function NtShutdownSystem& Lib "ntdll