J
John Wright
First some background:
I have been asked to develop a program that access our data warehouse. It
requires a login and password to use so we created a custom control that is
placed on the form, the user types in their username/password, we validate
then return either true or false. The program hosting the control has no
access to the keydown and keyup events from the control. This user control
is used throughout the plant and by many developers. Now we need to use it
for the access the warehouse. We must log everyone that attempted to log
into the system and everyone who logs into the system. I cannot capture
this by the control we use, so I created a class that extends the control
and listens for messages. It inherits from the
System.Windows.Forms.NativeWindow object.
I have overridden the WndProc process and raise an event passing out the
System.Windows.Forms.Message. I need to interrupt the message that is thrown
and then log the username that was entered. I can get an ASCII value using
the WParam but it only gives me upper case and freaks out when the shift key
is pressed (usernames can be something like J0hnD03). Does anyone know how
to read this message and see what key was pressed?
Thanks.
John
One the form side, I have the following routine:
Private Const WM_KEYDOWN As System.Int32 = &H100
Private Const WM_KEYUP As System.Int32 = &H101
Private Const WM_SYSKEYDOWN As Integer = &H104
Private Const WM_SYSKEYUP As Integer = &H105
Dim WithEvents abc As Hooked
'Code I need help with
Private Sub abc_CallBackProc(ByVal m As System.Windows.Forms.Message)
Handles abc.CallBackProc
Select Case m.Msg
Case WM_KEYDOWN
TextBox2.Text &= ChrW(m.WParam)
End Select
End Sub
I have been asked to develop a program that access our data warehouse. It
requires a login and password to use so we created a custom control that is
placed on the form, the user types in their username/password, we validate
then return either true or false. The program hosting the control has no
access to the keydown and keyup events from the control. This user control
is used throughout the plant and by many developers. Now we need to use it
for the access the warehouse. We must log everyone that attempted to log
into the system and everyone who logs into the system. I cannot capture
this by the control we use, so I created a class that extends the control
and listens for messages. It inherits from the
System.Windows.Forms.NativeWindow object.
I have overridden the WndProc process and raise an event passing out the
System.Windows.Forms.Message. I need to interrupt the message that is thrown
and then log the username that was entered. I can get an ASCII value using
the WParam but it only gives me upper case and freaks out when the shift key
is pressed (usernames can be something like J0hnD03). Does anyone know how
to read this message and see what key was pressed?
Thanks.
John
One the form side, I have the following routine:
Private Const WM_KEYDOWN As System.Int32 = &H100
Private Const WM_KEYUP As System.Int32 = &H101
Private Const WM_SYSKEYDOWN As Integer = &H104
Private Const WM_SYSKEYUP As Integer = &H105
Dim WithEvents abc As Hooked
'Code I need help with
Private Sub abc_CallBackProc(ByVal m As System.Windows.Forms.Message)
Handles abc.CallBackProc
Select Case m.Msg
Case WM_KEYDOWN
TextBox2.Text &= ChrW(m.WParam)
End Select
End Sub