Jump to content
Sign in to follow this  
Andrew Chen

How do I check if the user presses a key?

Recommended Posts

Andrew Chen

I am trying to watch if the user presses [ESC] key, to terminate the program. Thanks

Share this post


Link to post
Share on other sites
Andrew Chen

Thanks! If I put this while loop in the top of my code, will the rest still run, or will it be stuck in this while loop?

Share this post


Link to post
Share on other sites
Donald8282

Post your source and I'll show you where to put it.

Share this post


Link to post
Share on other sites
somdcomputerguy

That code is wrong, hotkeyset shouldn't be in a while loop, it should be like this:

HotKeySet("{ESC}", "_Exit")

While 1
    Sleep(10)
WEnd

Func _Exit()
    Exit
EndFunc
Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
Andrew Chen

ahh okay, that makes everything much easier. Thanks

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.