VB2010 - Hotkeys

Hello,

In this tutorial I'll teach you how you can use hotkeyfunctions in Visual Basic (2008 or) 2010.

1.Start by creating or opening a project. (call it hotkeyfunctions)
2. Add:
*1x Timer (Enabled = True) (Interval = 100)
3. Go to the codes, and add the following line of code at the top of your codes.


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

4. Double click the new timer and add the following codes:

Dim starthotkey, stophotkey As Boolean

        stophotkey = GetAsyncKeyState(Keys.F4)

        starthotkey = GetAsyncKeyState(Keys.F3)

        If starthotkey = True Then

            'Start codes here

        End If

        If stophotkey = True Then

            'Stop codes here

        End If


As you can see, the F4 and F3 are used as hotkeys. You can change them (Intellisense will help you select a key)

 You have now created your very own hotkey application !

Download the source codes:
Hotkeyprogram.rar (63,4 kB)


Topic: VB2010 - Hotkeys

Date: 06/10/2012

By: Adam

Subject: error

Ive been trying all kinds of hot key codes and it seems reguardless of what i do it gives me either a pinvoke error or a error reguarding unhandled something or another is there anyway you can help me?

Reply

—————