VB如何定时关机
PrivateSubCommand1_Click()x=Val(Text1.Text)Shell("shutdown.exe-s-t&x")EndSubPrivateSu...
Private Sub Command1_Click()
x = Val(Text1.Text)
Shell ("shutdown.exe -s -t & x")
End Sub
Private Sub Command2_Click()
Shell "shutdown.exe -a ", vbNormalFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii <> 13) Then
KeyAscii = 0
End If
End Sub 我把X换成数字就能关机,但我想把数定输入到text中,也让它能关机,怎么做 展开
x = Val(Text1.Text)
Shell ("shutdown.exe -s -t & x")
End Sub
Private Sub Command2_Click()
Shell "shutdown.exe -a ", vbNormalFocus
End Sub
Private Sub Text1_KeyPress(KeyAscii As Integer)
If ((KeyAscii < 48 Or KeyAscii > 57) And KeyAscii <> 8 And KeyAscii <> 46 And KeyAscii <> 13) Then
KeyAscii = 0
End If
End Sub 我把X换成数字就能关机,但我想把数定输入到text中,也让它能关机,怎么做 展开
展开全部
Dim Sec As Long
Private Sub Form_Load()
Timer1.Interval = 1000
Sec = 600 ‘这里修改为你需要的倒计时时间
Label1 = Sec & "秒后关机"
End Sub
Private Sub Timer1_Timer()
Sec = Sec - 1
Label1 = Sec & "秒后关机"
If Sec <= 0 Then
Shell "Shutdown -s -f -t 0"
End If
End Sub
借鉴这个,自己修改
Private Sub Form_Load()
Timer1.Interval = 1000
Sec = 600 ‘这里修改为你需要的倒计时时间
Label1 = Sec & "秒后关机"
End Sub
Private Sub Timer1_Timer()
Sec = Sec - 1
Label1 = Sec & "秒后关机"
If Sec <= 0 Then
Shell "Shutdown -s -f -t 0"
End If
End Sub
借鉴这个,自己修改
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Shell "shutdown.exe -s -t " & Text1.Text
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Shell ("shutdown.exe -s -t & x")
改成
Shell "shutdown.exe -s -t " & x
改成
Shell "shutdown.exe -s -t " & x
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
一楼正解
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |