by Thorsten Sanders (1 Submission)
Category: Windows API Call/Explanation
Compatability: Visual Basic 3.0
Difficulty: Beginner
Date Added: Wed 3rd February 2021
Rating:
(7 Votes)
The code is very easy to make your own systemwide hotkeys with API Call!
Assumes
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 DeclarationsPublic Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer
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