/ / Customize the function getFormNameat, get the Name of the form of the form
Function GetFormNameat (x, y: integer): String;
VAR
P: tpoint;
W: TwinControl;
Begin
P.x: = x;
P.y: = y;
W: = FindvCLWindow (P); // Get the VCL visual component under the mouse pointer
IF (NIL <> w) THEN
Begin
While W.Parent <> nil do // Continue to find it when the super-level PARENT is not empty
W: = w.parent;
Result: = w.Name; // Last Name Name Name
end
Else
Begin
Result: = '';
END;
END;
Procedure TFORM1.CLICK (Sender: TOBJECT);
VAR
Winpos: tpoint;
Begin
GetCursorpos (WinPOS); // Get the coordinates of the current mouse pointer on the screen
Form1.name = getFormNameat (WinPos.x, WinPos.y)
END;