Solved

Capture ENTER on number and not main keyboard

Posted on 2003-10-29
9
209 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
Comment Utility
AFAIK, the answer is no.
0
 

Author Comment

by:Adam95GTS
Comment Utility
Was afraid of that.
0
 
LVL 96

Expert Comment

by:Bob Learned
Comment Utility
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
 
LVL 17

Expert Comment

by:zzzzzooc
Comment Utility
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
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 96

Expert Comment

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

Accepted Solution

by:
mazfar earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Adam, mazfar has the correct and direct answer. Well done!
0
 

Author Comment

by:Adam95GTS
Comment Utility
Excellant, thanks alot for the help!!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

728 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now