Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 42215

VS 2012 GetAsyncKeyState help

$
0
0
Hi, i have a problem with my hotkey using GetAsyncKeyState.
I use ctrl, shift and A for the hotkey but the problem is it still works with only Shift pressed.
Why aren't ctrl and A working?

Code:

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

Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        Dim ctrlkey As Boolean
        Dim shiftkey As Boolean
        Dim a As Boolean

        ctrlkey = GetAsyncKeyState(Keys.ControlKey)
        shiftkey = GetAsyncKeyState(Keys.ShiftKey)
        a = GetAsyncKeyState(Keys.A)

        If ctrlkey And shiftkey And a = True Then
            Button1.PerformClick()
        End If
    End Sub


Viewing all articles
Browse latest Browse all 42215

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>