Visual Basic脚本-KeyPress检测? [英] Visual Basic Script - KeyPress Detection?
本文介绍了Visual Basic脚本-KeyPress检测?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在按下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
推荐答案
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脚本-KeyPress检测?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文