定时关机小程序
界面 :
实现代码 :
代码如下::
<kopf>
<title> 定时关机小程序 </title>
<Hta: Anwendung
ApplicationName = "hta test"
Borde = "dünn"
BORDERSYLE = "Erhöht"
Icon = "c: /windows/system32/control.exe"
Scroll = "nein"
SingleInInstance = "Ja"
MaximizeButton = "nein"
MinimizeButton = "nein"
WindowState = "normal"
>
</head>
<script Language = "vbscript">
Sub window_onload
strComputer = "."
Setzen Sie objwmiservice = getObject ("Winmgmts: //" & StrComputer & "/root/cimv2")
Setzen Sie ColItems = objwmiservice.execQuery ("Select * aus Win32_Desktopmonitor"))
Für jedes Objitem in Colitems
inthorizontal = objitem.screenwidth
intvertical = objitem.screenHeight
Nächste
intleft = (inthorizontal - 240) / 2
inttop = (intvertical - 500) / 2
Fenster.Resizeto 240.500
window.moveto intleft, inttop
Ende sub
Sub Oneub
Setzen Sie ObjectShell = createObject ("wscript.shell")
Ireturn = ObjectShell.run ("Shutdown -S -f -t 1800", 0, True)
Ende sub
Sub Twosub
Setzen Sie ObjectShell = createObject ("wscript.shell")
Ireturn = ObjectShell.run ("Shutdown -S -f -t 2700", 0, True)
Ende sub
Sub Thrsub
Setzen Sie ObjectShell = createObject ("wscript.shell")
Ireturn = ObjectShell.run ("Shutdown -S -f -t 3600", 0, True)
Ende sub
Sub OK
Wenn isnumerisch (text.Value) dann
Überstunden = text.Value * 60
Setzen Sie ObjectShell = createObject ("wscript.shell")
Ireturn = ObjectShell.run ("Shutdown -s -f -t" & Überstunden, 0, true)
Anders
MSGBox "请输入一个有效的数字。"
Ende wenn
Ende sub
Sub -Abschaltung
Setzen Sie ObjectShell = createObject ("wscript.shell")
Ireturn = ObjectShell.run ("Shutdown -s -t 0", 0, True)
Ende sub
Sub Eshutdown
Setzen Sie ObjectShell = createObject ("wscript.shell")
ireturn = ObjectShell.run ("Shutdown -a", 0, true)
Ende sub
</script>
<body>
<br>
<Center> <div> <Eingabe type = "button" style = "Höhe: 30px; Linienhöhe: 20px; Rand: 1px Solid #aaa;" value = "30 分钟后关闭计算机" name = "run_button" onclick = "OneSub"> <p> </div> </center>
<Center> <div> <Eingabe type = "button" style = "Höhe: 30px; Linienhöhe: 20px; Rand: 1px Solid #aaa;" value = "45 分钟后关闭计算机" name = "run_button" onclick = "twosub"> <p> </div> </center>