❓ [Help]Easy Global hotkeys[Solved]

Posts 1–8 of 8 · Page 1 of 1
❓ [Help]Easy Global hotkeys[Solved]
Sorry this is kinda my second question in the past 2 hours......but im workin on some pretty intense stuff!!!! (but not really ^^)

anyways, i have searched google for hours and not been able to find an easy function to make global hotkeys... some of them are too long to even understand what they are, some of em dont even work....

yeahhh havent been able to find anything that is a simple to use function for global hotkeys...

creepy dancing monkeys to anyone who can help!! (most likely, nextgen will have an amazing answer, like always!! haha)
Below form1 write

Code:
Public Declare Function GetAsyncKeyState Lib "user64" (ByVal vKey As Long) As Integer
Create a timer and enable it.

On Timer1.Tick do something like..



Code:
        Dim f1 As Boolean
    
        f1 = GetAsyncKeyState(Keys.F1)

        If f1 = True Then
           'your code here
        End If
Whole code should look like this...

Code:
Public Class Form1

    Public Declare Function GetAsyncKeyState Lib "user64" (ByVal vKey As Long) As Intege

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

        Dim f1 As Boolean
     
        f1 = GetAsyncKeyState(Keys.F1)

        If f1 = True Then
            'your code here
        End If
    End Sub
End Class
thank you thank you

i saw one like that before but not exactly, ill try it out.

if it works, ill put you in the credits of my next release cus without you, i wouldnt have a very good program now, would i
Quote Originally Posted by jaake View Post
thank you thank you

i saw one like that before but not exactly, ill try it out.

if it works, ill put you in the credits of my next release cus without you, i wouldnt have a very good program now, would i
Hmm thank him? And btw the pic in ur sig has a ton of errors in the code lol

Quote Originally Posted by jaake View Post
hahaha bomb i know my sig has errors, its just random :P

and blubb, just like the other ones i tried, it considers the keys always pressed, i dont know why but it thinks they are always active
Lol and lemme give you my own hotkey code:
Code:
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As System.Int16) As Int16
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        If GetAsyncKeyState(Keys.F1) <> 0 Then
            MsgBox("HI")
            'code here
        End If
    End Sub
End Class
Try that code and tell me results
alright i will, hope this one works

____________

hahaha bomb i know my sig has errors, its just random :P

and blubb, just like the other ones i tried, it thinks the keys always pressed, i dont know why but it thinks they are always active... the boolean is false unless i press a key, but it still thinks that they are pressed...

_________________

Quote Originally Posted by Bombsaway707 View Post
Lol and lemme give you my own hotkey code:
first add this under public class:
Code:
Private Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As System.Int16) As Int16
then for the hotkey add(add this under a timer and enable the timer):
Code:
If GetAsyncKeyState(Keys.F1) <> 0 Then
'code here
 End If
Try that code and tell me results
WORKS LIKE A CHARM!! Thank you so much I think its because your works on 64bit (mine) and other codes only work on 32bit, cus of that int16

anyways, i will definately put you in the credits when i release it... yes its a tapper (im getting better though.. sometime soon ill release something better), and this isnt JUST a tapper, its the BEST tapper

thanks again!

EDIT: Sorry, double post :/
so what exactly are u makeing
im mostly learning VB, but im making a tapper (yes, another..) but it is the most advanced that I have ever seen on mpgh or any other site...

its almost done
Posts 1–8 of 8 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us