May I ask exactly why you want to do that? It's quite possible that there's a better way to achieve your aim.How do I detect left mouse button down and up events on the 'Close' option of the system menu that appears when the mouse is clicked on the top left corner of a form?
Public Class Form2 Private Const WM_SYSCOMMAND As Integer = &H112 Private Const SC_CLOSE As Integer = &HF060 Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message) ' Check if the user is consuming the system command to close the form. If (m.Msg = WM_SYSCOMMAND) AndAlso (CInt(m.WParam) = SC_CLOSE) Then MsgBox("Form closing by system command. Take necessary actions here...") End If MyBase.WndProc(m) End Sub Private Sub btnClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClose.Click Close() End Sub End Class