VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Make your own Hotkey easy with API

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 Declarations
Public Declare Function GetAsyncKeyState Lib "user32" Alias "GetAsyncKeyState" (ByVal vKey As Long) As Integer

Rate Make your own Hotkey easy with API

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

Download this snippet    Add to My Saved Code

Make your own Hotkey easy with API Comments

No comments have been posted about Make your own Hotkey easy with API. Why not be the first to post a comment about Make your own Hotkey easy with API.

Post your comment

Subject:
Message:
0/1000 characters