Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Capture ENTER on number and not main keyboard

Posted on 2003-10-29
9
211 Views
Last Modified: 2012-05-04
Is it possible to programatically know the difference from when the ENTER key on the number pad is pressed rather that the ENTER key on the main part of the keyboard.  Client is wanting to use the ENTER on the number pad as a TAB and the ENTER key on the main part of the keyboard as the normal ENTER key function
0
Comment
Question by:Adam95GTS
9 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9644995
AFAIK, the answer is no.
0
 

Author Comment

by:Adam95GTS
ID: 9645022
Was afraid of that.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9645036
Sometimes, you have to take a step back and analyze customer requests to see "why" they want to do things, and try to talk them out of "non-standard" behavior for software.  We get those kind of requests all the time, and I have learned to ignore most of them.

There is supposed to be a difference in the Virtual Key code, but experience has shown that to not be the case.  There may still be some magic out there, but I haven't found it yet.
0
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

 
LVL 17

Expert Comment

by:zzzzzooc
ID: 9645669
I think i've seen games that implement an extended Enter (NumPad) and regular Enter for keyboard mapping, not sure how though. Might be possible with a keyboard-hook if it allows KEYEVENTF_EXTENDEDKEY checks.

But, you could just have the user press the NumLock when they wish to use the NumPad enter. Then you can just check the state of the NumLock to differ between the two.

Private Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As Integer
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then
        If GetKeyState(vbKeyNumlock) = 1 Then
            MsgBox "Enter Pressed (NumPad)"
        Else
            MsgBox "Enter Pressed"
        End If
    End If
End Sub
Private Sub Form_Load()
    Me.KeyPreview = True
End Sub
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9645710
Bending to customer requests can make you invent some crazy stuff!!
0
 
LVL 1

Accepted Solution

by:
mazfar earned 50 total points
ID: 9645873
The solution is given in a microsoft article at the link below:

http://support.microsoft.com/default.aspx?scid=kb;en-us;188550

ciao
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 9645894
Like I said there is some magic out there that I hadn't found yet.  There is always room to learn.
0
 
LVL 5

Expert Comment

by:fantasy1001
ID: 9647554
Adam, mazfar has the correct and direct answer. Well done!
0
 

Author Comment

by:Adam95GTS
ID: 9649847
Excellant, thanks alot for the help!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question