VB6是否使用计时器检测按键?
问题描述:
你好
我正在VB6中为一个大学项目工作,并且我使用计时器来检测按键,因此该代码最多每秒可以执行十次.
I am working in VB6 for a college project, and I am using a timer to detect key presses so that the code can only be executed up to ten times a second.
我创建了一个间隔为100的计时器,以使其每十分之一秒滴答"一声,但是我目前不确定如何从中检测按键.经过一段时间的Google搜索页面,我认为最好问一下 在这里.
I have created a timer with interval 100 so that it 'ticks' every tenth of a second, but I am currently unsure as to how I would go about detecting key presses from it. After a while of searching through pages on Google, I figured it would be best to ask here.
预先感谢.
答
您需要做的不是从计时器中检测到按键,而是抑制所有传入的按键直到计时器滴答作响
What you need to do is not to detect keypressed from within your timer, but to supress any incoming keypress until the timer ticks