#Enter vs. Enter?
9 messages in this thread
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.
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.
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
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.
Mark and John,
Oops.
–Ethan
Sorry – I'm talking about Visual BASIC, under Windows. Visual BASIC doesn't
have an INKEY$.
There is 1 Reply.
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
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.
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