Detecting a click on the caption bar.
Option Strict On
Option Explicit On
Imports System
Imports System.Windows.Forms
Imports System.Drawing
Public Class Form1
Inherits Form
Private ReadOnly WM_NCLBUTTONDOWN As Integer = &HA1
Public Sub New()
Me.Text = "Window Caption"
End Sub
Protected Overrides Sub WndProc(ByRef m As Message)
If m.msg = WM_NCLBUTTONDOWN Then
Console.WriteLine("caption click...")
End if
MyBase.WndProc(m)
End Sub
<STAThread()> _
Shared Sub Main()
Application.Run(New Form1())
End Sub
End Class