You can handle KeyDown event and check if Shift
is pressed.
e.KeyCode = Keys.Shift
You can work with user32.dll lib and send the key release.
&H10
is Shift
key code. Here is a list of all key codes (replace 0x
with &H
).
&H2
means release. Type &H0
if you want to press.
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
keybd_event(&H10, 0, &H2, 0)
You may want to handle entire form's KeyDown events.
Form.KeyPreview = True
Here is an example.
Public Class Form1
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Integer, ByVal dwExtraInfo As Integer)
Private Sub Form1_Load(sender As Object, e As System.EventArgs) Handles Me.Load
Me.KeyPreview = True
End Sub
Private Sub Form1_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.Shift Then
Form1.keybd_event(&H10, 0, &H2, 0)
End If
End Sub
End Class