[Help] Global Hotkey [Solved]

Posts 1–7 of 7 · Page 1 of 1
[Help] Global Hotkey [Solved]
i was doing some mini projects on the tutorial section,

Tutorial: Hotkeys with a Module

when i tried to do this one, i encountered this error, can you pls tell me what am i doing wrong?

put this code in ur form
Code:
Declare Function GetAsyncKeyState Lib "user32" (Byval vKey As Integer) As Integer
put this code in ur timer
Code:
If GetAsyncKeyState(Keys.Insert) Then : Msgbox("Insert") : End If
solved it on my own,

changed this part:

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer

to:

Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Integer) As Integer

thank you top cent, figured it out a sec ago

Quote Originally Posted by T0P-CENT View Post
put this code in ur form
Code:
Declare Function GetAsyncKeyState Lib "user32" (Byval vKey As Integer) As Integer
put this code in ur timer
Code:
If GetAsyncKeyState(Keys.Insert) Then : Msgbox("Insert") : End If
do you know how to make it with alt/shift/ctrl?

hotkeys like alt+q in code
Code:
If GetAsyncKeyState(Keys.ShiftKey) And GetAsyncKeyState(Keys.N) Then
            MsgBox("You pressed shift + N")
        End If
method 1 ^^
method 2
Code:
If GetAsyncKeyState(Keys.A) Then
If GetAsyncKeyState(Keys.B) Then
Msgbox("You pressed A AND B")
End If
End If
how do you target the process you want to send keys to? like i want to send some keys to a certain program


also whats the api or function to send keys in the background (Afk bot like)
Quote Originally Posted by wee123 View Post
how do you target the process you want to send keys to? like i want to send some keys to a certain program


also whats the api or function to send keys in the background (Afk bot like)
The question isn't exactly related to the issue of globally detected hotkeys, which is just a case of a minor keyboard hook or an API call. Sending keystrokes to a minimized process is somewhat more difficult and will require you to look into SendMessage/SendInput. It ain't always easy.

Original thread question is now solved.
Quote Originally Posted by wee123 View Post
how do you target the process you want to send keys to? like i want to send some keys to a certain program


also whats the api or function to send keys in the background (Afk bot like)

this check if u pressed a key not sending a key to application
and afk bots it just makes a mouse click and move ur cursor
Posts 1–7 of 7 · Page 1 of 1
This thread is closed for replies.

Tags for this Thread

None

Talk with us