CompuServe Thread

#Enter vs. Enter?

9 messages in this thread
#3118From: SyndesisOct 15, 1991 1:06 AM
I'd like to distinguish between the Enter key on the main keyboard, and the Enter key on the numeric keypad. I've tried KeyUp, KeyDown, KeyPress, but they're no help. Is this even possible? I thought I remembered being able to distinguigh between them years ago under DOS in a C program… There is 1 Reply.
#3136From: Ethan WinerOct 15, 1991 5:16 AM
John, In order to distinguish between the two Enter keys you will need to call the BIOS Interrupt 16h in place of INKEY$. This interrupt service returns the scan code of the ket pressed, as well as its ASCII value. Personally, I prefer programs that do -not- mess around at a lower level than necessary. For example, the NET MAIL system in our Lantastic network drives me nuts when it beeps at me for pressing the "wrong" Enter key…. –Ethan There are 2 Replies.
#3164From: George CampbellOct 15, 1991 9:17 AM
Ethan, Aside from that, there are a lot of users who remain faithful to the old 88-key AT keyboard. You could get in real trouble by specifying a non-existant key, I would think. George
#3253From: Mark Novisoff/MicroHelpOct 15, 1991 3:38 PM
Ethan, You did the same thing I did earlier this week, but in reverse <grin>. He was asking how to do this in the VB section and you gave him the DOS answer. I had a fellow ask about communications in the QB/PDS section, and I replied with my "canned" VB reply. The moral of the story — we've gotta watch the section numbers…… Mark There is 1 Reply.
#3386From: Ethan WinerOct 16, 1991 8:26 AM
Mark and John, Oops. –Ethan
#3336From: SyndesisOct 15, 1991 11:15 PM
Sorry – I'm talking about Visual BASIC, under Windows. Visual BASIC doesn't have an INKEY$. There is 1 Reply.
#3358From: Jonathan Zuck (UFI)Oct 16, 1991 1:28 AM
John, You can simulate INKEY$ under VB using the PeekMessage API call. This will allow you access to the scan code that you need here. -=Jonathan
#3399From: SyndesisOct 16, 1991 10:29 AM
Oh, yeah. I forget you can use all those neat Windows calls. (I program "Harvard Draw" for SPC during each morning, in C, under Windows.) But where would I put this PeekMessage call? It's not like the event loop is under VB control, right? Which VB subroutine gets called when that person hits the keypad Enter? I'll get a KeyPress, but the scancode has been cooked and removed from the list already, right? There is 1 Reply.
#3447From: Jonathan Zuck (UFI)Oct 16, 1991 5:19 PM
John, You can put a well-behaved PeekMessage loop in your Sub Main that will intercept keystrokes but not affect the rest of the program or anywhere for that matter. You would then Select Case through the key just like you would in C. You can parse the scan code out of the the lParam. -=- Jonathan