I\'m using SendKeys in an automation program for work. I\'ve been plodding along, and am now trying to iron out all the bugs that I\'ve created :-)
One of which, is
I have an application, where I frequently need to switch between left-SHIFT and TAB. On my keyboard CAPSLOCK is between those 2 keys and I mistake now and then, typing a CAPSLOCK instead of a TAB. My solution is to reverse CAPSLOCK and submit a TAB instead. To my surprise the program loops until stack-overflow. I found out that the CAPSLOCK-key is send twice. This is my final solution:
Dim CapsLockProg As Integer = 0 ' after Send Capslock arrives 2 times!!!!!
Private Sub Description_KeyDown(sender As Object, e As KeyEventArgs) Handles Description.KeyDown
If e.KeyCode = Keys.Capital Then
If CapsLockProg < 2 Then
CapsLockProg += 1
If CapsLockProg = 1 Then
Windows.Forms.SendKeys.SendWait("{TAB}{CAPSLOCK}")
'Else
' ignore 2nd Capslock
End If
Else
CapsLockProg = 0
End If
End If
If e.KeyCode = Keys.Tab Then
rest of code
does this work for you?
if(Control.IsKeyLocked(Keys.CapsLock))
SendKeys.SendWait("{CAPSLOCK}This Is An Over Capitalized Test String");
else
SendKeys.SendWait("This Is An Over Capitalized Test String");