Make your own Hotkey easy with API
The code is very easy to make your own systemwide hotkeys with API Call!
Original Author: Thorsten Sanders
Assumptions
Make a new module and put the API Call in the module.
You have to add a timer to your Form leave the standard name, put the intervall to 100 or when you want less or more you can do also, it is for how often he checks if the hotkey was pressed.
API Declarations
Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
Code
Private Sub Timer1_Timer()
If GetAsyncKeyState(vbKeyControl) And GetAsyncKeyState(vbKeyO) Then
MsgBox "It works :)"
End If
End Sub
'this example use the Control Key and O key as hotkey but you can use that key and how many keys you want alle the key codes you will find in the vb help under key code constants
Loading Comments ...
Comments
No comments have been added for this post.
You must be logged in to make a comment.