Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21308

Weird Form Keypress issue

$
0
0
Hey all,

I have an odd issue with my app. Right now I have a form that pauses execution to display some text, then resumes execution by pressing the Space bar, this way:

Code:

Private Sub Form_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeySpace Then exits = True
End Sub

I call it this way in the code:

Code:

Do
DoEvents
Loop Until exits
exits = False

I call this routine (stopti) to pause execution until the Space bar is pressed (connects to the above):

Code:

Public Sub stopti()
Timer1.Interval = 0.1
Timer1.Enabled = True
FinishedTime = DateAdd("s", comtextspeed, Now)
While Now < FinishedTime
DoEvents
Wend
Timer1.Enabled = False
End Sub

It works great, responding perfectly to the Space bar press...unless I minimize the app to use another app or the browser, in which case when I come back to the app it stops responding to the Space bar keypresses completely. Is there a way to just make it wait patiently and act normally to keypresses, even if the user uses something else and comes back to the app?

Thanks!

Viewing all articles
Browse latest Browse all 21308

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>