0

I am making a fake virus program as a joke and would like to know how to disable all of the keys except for the shift and enter keys.(these will exit the program) Thanks

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by codeorder
0

See if this helps.

Public Class Form1
    Private WithEvents myCoolTimer1 As New Timer With {.Interval = 100, .Enabled = True}

    Private Sub Form1_KeyUp(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        If e.KeyCode = Keys.Escape Then Me.Close() '// .Close app. on ESC key.
    End Sub

    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        With Me
            .KeyPreview = True '// for ESC key.
            .Opacity = 0 '// make transparent.
            .ShowInTaskbar = False
        End With
    End Sub

    Private Sub myCoolTimer1_Tick(sender As Object, e As System.EventArgs) Handles myCoolTimer1.Tick
        With Me
            If Not .Focused Then .Activate() '// keep app. constantly focused.
        End With
    End Sub
End Class
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.