I need a way to simulate keyboard keys if a certain condition is met, I also need to know if it's the simulated key that's currently pressed or the real key. This needs to work outside the main application.
This is how I would need it to work:
Dim UserDefinedKey As Keys = Keys.H
Do
If GetAsyncKeyState(UserDefinedKey) Then
Thread.Sleep(30)
'release the set key
Thread.Sleep(30)
'press/hold the set key once, continue the loop if the real key is still been held.
End If
Loop While GetAsyncKeyState(UserDefinedKey) '/ loop while real key is being held
'Real key is no longer held, release the simulated key press.
Any help would be greatly appreciated.
(This code is to automate certain things inside of a game which is why it needs to work outside the main application)
I have certain things in place to allow the user to set their own key, this was just a small example of what I need, it's just the keyboard simulating part i'm stuck with and determining if the real key is still pressed or not.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…