Reword the question : it give by the ENTER a BEEP ,i will not a beep !
Source code :
Private Declare Function PeekMessage Lib "user32" Alias _
"PeekMessageA" (lpMsg As MSG, ByVal hwnd As Long, _
ByVal wMsgFilterMin As Long, ByVal wMsgFilterMax As Long, _
ByVal wRemoveMsg As Long) As Long
Private Type POINTAPI
x As Long
y As Long
End Type
Private Type MSG
hwnd As Long
message As Long
wParam As Long
lParam As Long
time As Long
pt As POINTAPI
End Type
Const PM_NOREMOVE = &H0
Const WM_KEYDOWN = &H100
Const WM_KEYUP = &H101
Const VK_RETURN = &HD
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Dim MyMsg As MSG, RetVal As Long
' pass:
' MSG structure to receive message information
' my window handle
' low and high filter of 0, 0 to trap all messages
' PM_NOREMOVE to leave the keystroke in the message queue
' use PM_REMOVE (1) to remove it
RetVal = PeekMessage(MyMsg, Me.hwnd, 0, 0, PM_NOREMOVE)
' now, you should look for a MSG.wParam of VK_RETURN
' if this was the keystroke, then test bit 24 of the lparam - if ON,
' then keypad was used, otherwise, keyboard was used
If RetVal <> 0 Then
If MyMsg.wParam = VK_RETURN Then
If MyMsg.lParam And &H1000000 Then
MsgBox "Enter from Keypad pressed"
Else
MsgBox "Enter from Keyboard pressed"
End If
End If
Else
MsgBox "No message waiting, or possible problems calling PeekMessage"
End If
End Sub
Eric De Decker
vbg.be@vbgroup.nl
Licence And Copy Protection AxtiveX
Source CodeBook for the programmer