商城首页欢迎来到中国正版软件门户

您的位置:首页 > 软件教程 >VB编写的定时关机程序的源代码是怎么样的?

VB编写的定时关机程序的源代码是怎么样的?

  发布于2025-01-26 阅读(0)

扫一扫,手机访问

VB做定时关机程序的源代码怎样的

添加一个command 、一个 textbox 一个时间控件 。

timer1.

代码如下:Private Sub Command1_Click()

Text1.Text = Text1.Text - 1

If Text1.Text = "0" Then

Command2.Enabled = True

Command1.Enabled = False

Text1.Enabled = False

Shell "cmd.exe /c shutdown.exe -s -t 0", vbHide

End If

End Sub

Private Sub Command2_Click()

Timer1.Enabled = False

Command1.Enabled = True

Command2.Enabled = False

Text1.Enabled = True

End Sub

Private Sub Form_Load()

Timer1.Enabled = False

Timer1.Interval = 1000

Command2.Enabled = False

End Sub

我还帮你实现了停止计时呢~~~ 程序界面大概这样VB做定时关机程序的源代码怎样的你复制代码进去就可以用了。。 如果你想要实现更多的功能的话,就加我QQ:554997416

VB编程解这是VB编的一个倒计时关机程序怎样使 x为用户自己输入

一分钟关机代码,你试下,我不试我不想关机

Dim tim As Integer

Private Sub Timer1_Timer() If tim >= 60 Then Shell "cmd.exe /c shutdown -s -t 0 " End If tim = tim + 1 End Sub

你迟迟不肯采纳,是不是要和你一样的代码

Dim x As Integer Private Sub Command1_Click() x = Val(InputBox("输入倒计时关机时间", "", "")) Shell "cmd.exe /c shutdown -s -t " & x End Sub

Private Sub Command2_Click() Shell "cmd.exe /c shutdown -a" End Sub

如何使用VB写关机小程序

帮你写了段代码

Private Sub Command1_Click()

If Text1 = "我是猪" Then

Shell "cmd.exe /c shutdown -a"

MsgBox "哈哈放过你吧!", 64, "提示"

End

End If

End Sub

Private Sub Form_Load()

MsgBox "哈哈你中招了、快说你是猪,否则1分钟就让你电脑关机", 48, "提示"

Shell "cmd.exe /c shutdown -s -t " & 60, vbHide

End Sub

Private Sub Form_Unload(Cancel As Integer)

g = MsgBox("想关掉我???", vbOKCancel + vbQuestion, "关闭窗口")

If g = vbOK Then

Cancel = 11

MsgBox "哈哈你关不掉我的快说我是猪吧", 64, "提示"

End If

If g = 2 Then

Cancel = 11

End If

End Sub

vb编个定时关机的

Private Sub Command1_Click()

If Val(Text1.Text) > 0 And Val(Text2.Text) > 0 And Val(Text3.Text) > 0 And Val(Text4.Text) > 0 And Val(Text5.Text) > 0 Then

Timer1.Enabled = True

Else

MsgBox "请输入时间"

End If

End Sub

Private Sub Form_Load()

Text1.Text = Year(Now)

Text2.Text = Month(Now)

Text3.Text = Day(Now)

Text4.Text = Hour(Now)

Text5.Text = Minute(Now)

Command1.Caption = "开始倒计时"

Timer1.Interval = 1000

Timer1.Enabled = False

End Sub

Private Sub Timer1_Timer()

Me.Caption = Format(Now, "YYYY-MM-DD HH:MM")

If Me.Caption = Text1 & "-" & Format(Text2, "00") & "-" & Format(Text3, "00") & " " & Format(Text4, "00") & ":" & Format(Text5, "00") Then Shell ("c:\windows\system32\shutdown.exe /s /t 0"): Timer1.Enabled = False

End Sub

本文转载于:https://www.docexcel.net/show/23_142858.html 如有侵犯,请联系admin@zhengruan.com删除

热门关注