Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles MyBase.KeyDown
' Code to Override the Alt-F4 keys combination
If e.KeyData = Keys.Alt + Keys.F4 Then
MessageBox.Show("Nice Try! You must log on with a password.", "Security", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
e.Handled = True
End If
End Sub
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const CS_NOCLOSE As Integer = &H200
cp.ClassStyle = cp.ClassStyle Or CS_NOCLOSE
Return cp
End Get
End Property