Get Focus Control from all window forms using Delp

2019-09-18 14:21发布

问题:

I am interested to get title/caption/text from all controls focused by the mouse in Delphi.

So moving the mouse after all controls from any windows i am interesting to retrieve the current object caption reached using the mouse.

Example: Narrator from Windows

回答1:

You'll need GetCursorPos to get the coordinates of the cursor on the screen and then use WindowFromPoint to get the windowhandle of the window/control at that location. After you've got the window handle, you can use it to retrieve or change the properties of the window/control with the Win32 api.

I found this example that shows you how to get the classname of a window/control using this method: http://delphi.about.com/cs/adptips2000/a/bltip1200_2.htm