all groups > visual studio .net general > october 2007 >
You're in the

visual studio .net general

group:

How to sense ESC key was pressed


How to sense ESC key was pressed Girish
10/31/2007 3:34:02 AM
visual studio .net general:
I have a long running loop that I want to exit/terminate from when the user
presses the ESC key in a Windows forms application (VS2005, VB language).

Can someone tell me how to achieve this?
Thanks
Re: How to sense ESC key was pressed Crest Teethgel
10/31/2007 2:08:52 PM
[quoted text, click to view]

Check for message WM_KEYDOWN or WM_KEYUP and virtual-key code VK_ESCAPE


Cordialy

Re: How to sense ESC key was pressed eBob.com
10/31/2007 9:30:06 PM
I'm a novice here, but when I look at a form's "Events" I see KeyDown,
KeyPress and KeyUp events. That sounds like what you are looking for and
should be easy to try. But, like I said, I am a novice.

Bob

[quoted text, click to view]

Re: How to sense ESC key was pressed Girish
11/2/2007 9:01:00 PM


[quoted text, click to view]
Re: How to sense ESC key was pressed Girish
11/2/2007 9:02:00 PM


[quoted text, click to view]
Thanks for your answer, but, Can you tell me how and where to check for
these messages?
Re: How to sense ESC key was pressed Girish
11/2/2007 9:06:00 PM

Bob, thanks for your reply, but these events don't trigger until the loop
completes execution. If the ESC key is pressed, even after a couple of
seconds after execution is inside a loop then the ESC key is sensed only
after completion of the loop. I have also set the forms keypreview property
to true.
Girish

[quoted text, click to view]
AddThis Social Bookmark Button