使用Delphi从所有窗口窗体获取焦点控制 [英] Get Focus Control from all window forms using Delphi

查看:418
本文介绍了使用Delphi从所有窗口窗体获取焦点控制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有兴趣从Delphi中鼠标聚焦的所有控件中获取标题/标题/文本。

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.

示例:Windows讲述人

Example: Narrator from Windows

推荐答案

您将需要 GetCursorPos 来获取屏幕上光标的坐标,然后使用 WindowFromPoint 获取该位置的窗口/控件的窗口句柄。有了窗口句柄后,您可以使用它来使用Win32 api检索或更改窗口/控件的属性。

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.

我发现此示例显示您如何使用此方法获取窗口/控件的类名: http:// delphi.about.com/cs/adptips2000/a/bltip1200_2.htm

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

这篇关于使用Delphi从所有窗口窗体获取焦点控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆