View Single Post
Old 1st August 2005, 20:09   #415  |  Link
stax76
Registered User
 
stax76's Avatar
 
Join Date: Jun 2002
Location: On thin ice
Posts: 6,837
Alt + F4 could be handled explicit:

Code:
Protected Overrides Sub WndProc(ByRef m As Message)
    If m.Msg = WM.SYSCOMMAND AndAlso m.WParam = CType(SC.CLOSE, IntPtr) Then
        MoveToTray()
        Exit Sub
    End If

    MyBase.WndProc(m)
End Sub

Private Sub MainForm_KeyDown(ByVal sender As Object, ByVal e As KeyEventArgs) Handles MyBase.KeyDown
    If e.KeyData = (Keys.Alt Or Keys.F4) Then
        Close()
    End If
End Sub
stax76 is offline