Get mouse handle
1. Call user32.dll (1) to reference using System. runtime. interopServices; (2) Call method 1. Obtain the window title [DllImport ("user32.dll")] public static extern int GetWindowText (IntPtr hWnd, StringBuilder lpString, int nMaxCount). Note: hWnd window handle lpString window title nMaxCount maximum value 2. Obtain the class name [DllImport ("user32.dll")] public static extern int GetClassName (IntPtr hWnd, StringBuilder lpString, int nMaxCount); note: hWnd handle lpString class name nMaxCount maximum 3 Obtain the window handle according to coordinates [DllImport ("user32.dll")] public static extern IntPtr WindowFromPoint (Point point); Note: Point Coordinate 2. display data (1) returns the Cursor coordinate int x = Cursor. position. x; int y = Cursor. position. y; this. textBox4.Text = string. format ("({0}, {1})", x, y); (2) obtain the handle Point p = new Point (x, y ); intPtr formHandle = WindowFromPoint (p); this. textBox1.Text = formHandle. toString (); (3) Get the window title GetWindowText (formHandle, title, t Itle. capacity); this. textBox2.Text = title. toString (); (4) obtain the Form class name StringBuilder cllassName = new StringBuilder (); GetClassName (formHandle, cllassName, cllassName. capacity); this. textBox3.Text = cllassName. toString (); (5) Load event this. timer1.Enabled =! This. timer1.Enabled; Note: Dynamic Display Information