Sometimes in case of Windows form application where we have multiple windows opened and we need to find on which window user has clicked. One method to find this is to capture the mouse click message. Here is the sample code to close form if mouse click happen outside the form. public partial class frmTest : Form { class Window CaptureChanged : NativeWindow { public CaptureChanged OnCaptureChanged ; protected override void WndProc ( ref Message m ) { if ( m . Msg == 533) // WM_CAPTURECHANGED OnCaptureChanged (); base . WndProc ( ref m ); } } public delegate void CaptureChanged (); public CaptureChanged OnCaptureChanged ; WindowCaptureChanged wcc ; public frmTest ( ) { Init
Learn Tips and tricks, Concepts, Ideas for software development