Hey guys! It's been awhile. I've Googl(ed?) this for a few hours and can't seem to find a straight forward answer. I'm working on a program and I can't seem to figure out how to make SendKeys actually Hold Down a key.
If I do this-
Then it literally spams the key as fast as possible. I just need it to hold down the key. I found this bit of code but I don't really understand how to utilize it-
Any help would be great! Thanks.
If I do this-
Code:
SendKeys.Send(W)
Loop
Code:
Private Sub LetKeyGo(ByVal key As Byte)
Dim kb_delay As Integer
Dim kb_speed As Integer
SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, kb_delay, 0)
SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, kb_speed, 0)
keybd_event(key, MapVirtualKey(key, 0), 2, 0)
End Sub
Private Sub HoldKeyDown(ByVal key As Byte)
Dim kb_delay As Integer
Dim kb_speed As Integer
SystemParametersInfo(SPI_GETKEYBOARDDELAY, 0, kb_delay, 0)
SystemParametersInfo(SPI_GETKEYBOARDSPEED, 0, kb_speed, 0)
keybd_event(key, MapVirtualKey(key, 0), 0, 0)
End Sub