How to prevent the functions of Alt + Tab , Alt + Escape and Other shortcut functions

2.4k Views Asked by At

I have this code to prevent closing a windows form using Alt + F4

Private Sub Form4_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
    If e.Alt = True And e.KeyCode = Keys.F4 Then
        e.Handled = True
    End If
End Sub

I am still looking to prevent the user by pressing the Alt + Tab. I try this code but its not working.

  If e.Alt = True And e.KeyCode = Keys.Tab Then
        e.Handled = True
    End If

and

If e.Alt = True And e.KeyCode = Keys.Escape Then
            e.Handled = True
        End If

Is there any solution on how to prevent these shortcuts functions in vb.net?. Specially the Ctrl + Alt + Del

0

There are 0 best solutions below