-
May 24th, 2009, 05:36 PM
#1
Reading keyboard within a sub
Is there any way to read the keyboard WITHIN a sub that I create? I really only want to see if somone pushes the "a" or "A" key to abort a lengthy operation. I am trying to avoid DO EVENTS at all cost. I just rewrote a bunch of code to remove doevents after it almost gave me an ulcer---all works great now., but I lost the abort ability.
Just wondering if reading the keyboard with a function or call is even possible.
I suppose I could dice up the lenghty operation into multiple calls of my sub using statics & thus allow a click event to "jump in between calls" to effect an abort.
-
May 24th, 2009, 08:15 PM
#2
Re: Reading keyboard within a sub
If you want to use the click event as interrupter - you can't do away with DoEvents. You may also try the Timer events if it will work on your needs.
Marketing our skills - please participate in the survey and share your insights
-
-
May 25th, 2009, 12:58 AM
#3
Re: Reading keyboard within a sub
GetAsyncKeyState API
Good Luck
-
May 30th, 2009, 07:33 PM
#4
Re: Reading keyboard within a sub
Is is really impossible to read or look for a key within your own created routine? Seems like there should be a simple api call so you can: A=abort, D=decrease amount, I=increase amount, etc within your own loop.
any ideas?
-
May 31st, 2009, 12:18 AM
#5
Re: Reading keyboard within a sub
From vb to vb, candies did you see my post #3???
If you had, you would not have asked your retorical question in post #4...
-
May 31st, 2009, 10:19 AM
#6
Re: Reading keyboard within a sub
Removing DoEvents may speed the app up on your system at the time, but it may lock up some other system that is doing different things (like playing music)
-
May 31st, 2009, 06:47 PM
#7
Re: Reading keyboard within a sub
Ähmmm... did somebody mention the KeyPress() event?
You set the focus to the element where you expect key input and the KeyPress() event will be easy to analyze what key has been pressed.
-
May 31st, 2009, 11:20 PM
#8
Re: Reading keyboard within a sub
Originally Posted by WoF
Ähmmm... did somebody mention the KeyPress() event?
You set the focus to the element where you expect key input and the KeyPress() event will be easy to analyze what key has been pressed.
Ahhh....
OP said in own sub/function which is looping and without the doevents....
-
June 1st, 2009, 01:48 PM
#9
Re: Reading keyboard within a sub
Ahhh... right. Missed that.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|