Posted: Sun Apr 15, 2012 4:36 am Post subject: How To Add Shortcut Keys To Your Application inVisual Basic?
I have made already a way to do it if your application is open. But when I go in a game the key doesn't work. Here's my code:
Code:
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
If e.KeyCode = Keys.F3 Then
stuff that you don't want to see.
End If
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
KeyPreview = True
End Sub
End Class
Joined: 25 Jan 2006 Posts: 8587 Location: 127.0.0.1
Posted: Sun Apr 15, 2012 5:07 am Post subject:
'Form1_KeyDown' requires your form to have focus in order for the key to be processed.
You will need to either register a global hotkey, or constantly monitor the keyboard status using an API call such as GetAsyncKeyState. _________________
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You can download files in this forum