2023年4月5日 星期三

VBNET 攔截key值

 Public Class Form1

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


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

        If GetAsyncKeyState(Keys.L) Then

            MsgBox("Tada!")

        End If

    End Sub

End Class

沒有留言:

張貼留言