定时关机小程序
界面
实现代码
代码如下:
<head>
<Title> 定时关机小程序 </title>
<HTA: Aplicação
ApplicationName = "Teste HTA"
Borde = "Thin"
Borderstyle = "Raise"
Icon = "c: /windows/system32/control.exe"
Scroll = "não"
SingleInstance = "Sim"
MaximizeButton = "não"
Minimizebutton = "não"
Windowstate = "Normal"
>
</head>
<Script Language = "VBScript">
Sub Window_onLoad
strComputer = "."
Definir objwmiservice = getObject ("winmgmts: //" & strcomputer & "root/cimv2")
SET COLITEMS = objwmiservice.execQuery ("Selecione * FROM WIN32_DESKTOPMONITOR")
Para cada objitem em colitems
inthorizontal = objitem.screenwidth
Intvertical = objitem.screenHeight
Próximo
intleft = (INTHORIZONTAL - 240) / 2
inttop = (Intvertical - 500) / 2
Window.Resizeto 240.500
Window.moveto Intleft, inttop
Final sub
Subensub
set objectShell = createObject ("wscript.shell")
iReturn = objectShell.run ("Shutdown -s -f -t 1800", 0, verdadeiro)
Final sub
Sub Twosub
set objectShell = createObject ("wscript.shell")
IreTurn = objectShell.run ("Shutdown -s -f -t 2700", 0, verdadeiro)
Final sub
Sub thrsub
set objectShell = createObject ("wscript.shell")
iReturn = objectShell.run ("Shutdown -s -f -t 3600", 0, verdadeiro)
Final sub
Sub ok
Se fornumérico (text.value), então
Prorrogação = text.value * 60
set objectShell = createObject ("wscript.shell")
IreTurn = objectShell.run ("Shutdown -s -f -t" & Hourtimpond, 0, true)
Outro
Msgbox "请输入一个有效的数字。"
Final se
Final sub
Sub Shutdown
set objectShell = createObject ("wscript.shell")
iReturn = objectShell.run ("Shutdown -s -t 0", 0, verdadeiro)
Final sub
Subeshutdown
set objectShell = createObject ("wscript.shell")
iReturn = objectShell.run ("Shutdown -a", 0, verdadeiro)
Final sub
</script>
<Body>
<br>
<Center> <div> <input type = "button" style = "altura: 30px; altura da linha: 20px; borda: 1px sólido #AAA;" value = "30 分钟后关闭计算机" name = "run_button" onclick = "ONEUB"> <P> </div> </fenter>
<Center> <div> <input type = "button" style = "altura: 30px; altura da linha: 20px; borda: 1px sólido #AAA;" value = "45 分钟后关闭计算机" name = "run_button" onclick = "twosub"> <p> </div> </central>