[Help]Hotkeys[Solved]

Posts 1–11 of 11 · Page 1 of 1
[Help]Hotkeys[Solved]
hai guys..
i want to add hotkeys for my program but they dont work...
i use at the Events of the form....
KeyDown>
Code:
if keys.f1 = true then
<action>
end if
so why they did not work?

PS:
there is Blubb
i will give you a tip.

Code:
e.
Although brinuz's will work with the form focussed, I find that global hotkeys are much better.

Add this declaration

[php]
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Int32) As Int16
[/php]

And then simply change your code to this:

[php]
if GetAsyncKeyState(keys.f1) then
'<action>'
end if
[/php]

And that's all there is to it.
@J-Deezy
Those that hotkey work even itf the form is not focused?
Quote Originally Posted by .Celtics View Post
@J-Deezy
Those that hotkey work even itf the form is not focused?
It most certainly does! Try it out on a timer_tick event

[php]

If GetAsyncKeyState(Keys.F5) Then
MsgBox("OH MY SWEET LORD, J-DEEZY SAID THE TREWTH!")
End if

[/php]
Quote Originally Posted by Jason View Post


It most certainly does! Try it out on a timer_tick event

[php]

If GetAsyncKeyState(Keys.F5) Then
MsgBox("OH MY SWEET LORD, J-DEEZY SAID THE TREWTH!")
End if

[/php]
Ok thanks for the info!
Quote Originally Posted by .Celtics View Post
Ok thanks for the info!
Anytime
Make sure you put that in a timer and enable it ^.-
Quote Originally Posted by Blubb1337 View Post
Make sure you put that in a timer and enable it ^.-
Oopsies, forgot that Thanks Kevin
Just pointing it out so he doesn't put it into the keydown event ^_^

Keydown = only affects if the control is focused
Getasynckeystate = global
API's ftw ^^
Posts 1–11 of 11 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us