本文介绍了Visual Basic 脚本 - 按键检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在按下 F1 键后终止程序.不确定如何编写 do while 循环.有什么想法吗?
I want to terminate the program once the key F1 is pressed.Not sure sure how to write the do while loop.Any Ideas?
Set WshShell = WScript.CreateObject("WScript.Shell")
Do While {F1} is not pressed
'...
Loop
推荐答案
这在普通的 VBScript 中是不可能的,但您可以使用 HTA:
This isn't possible in plain VBScript, but you may be able to get it to work with an HTA:
<head>
<title>Test</title>
<HTA:APPLICATION ID="oHTA"
APPLICATIONNAME="Test"
>
</head>
<script language="VBScript">
Sub CheckKey
If window.event.keyCode = 112 Then self.close()
End Sub
</script>
<body onKeyUp="CheckKey">
...
</body>
这篇关于Visual Basic 脚本 - 按键检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!