[HELP]Hotkeys

Posts 1–10 of 10 · Page 1 of 1
[HELP]Hotkeys
Ok, Im a newbie in vb. /
So do you actually make hotkeys to your application?
If its necessary, can you give a simple code

Thanks!
Search function is a pretty cool guy. He finds threads and doesn't afraid of anything.
Ok, thanks for the tip
You can close the thread naw
I'll leave it open in case you need any more help with hotkeys.
add this codes to form1_keydown
[php]If e.KeyCode = Keys.F2 Then
'Your command
End If[/php]
and go to properties
find KeyPreview set it as "True"!
Quote Originally Posted by aLcohoL_95 View Post
add this codes to form1_keydown
[php]If e.KeyCode = Keys.F2 Then
'Your command
End If[/php]
and go to properties
find KeyPreview set it as "True"!
Thanks! It worked
Another way is

Put this declaration under "Public Class Form1"

[php]

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

[/php]

Then in a timer add this:

[php]

Dim HOTKEY as Boolean = GetAsyncKeyState(Keys.F5) 'sets F5 as your hotkey'

If HOTKEY = True
'do whatever'
End If

[/php]
Quote Originally Posted by Jason View Post
Another way is

Put this declaration under "Public Class Form1"

[php]

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

[/php]

Then in a timer add this:

[php]

Dim HOTKEY as Boolean = GetAsyncKeyState(Keys.F5) 'sets F5 as your hotkey'

If HOTKEY = True
'do whatever'
End If

[/php]
ALWAYS use

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

Other may be buggy on x64 bit systems.
Quote Originally Posted by .Celtics View Post
Thanks! It worked
u r welcome
.)
Quote Originally Posted by aLcohoL_95 View Post
add this codes to form1_keydown
[php]If e.KeyCode = Keys.F2 Then
'Your command
End If[/php]
and go to properties
find KeyPreview set it as "True"!
This is only form and not system-wide though.
Posts 1–10 of 10 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?