在另一个应用程序中获取当前关注的控件的句柄 [英] Getting the handle of the currently focused control inside another application

查看:62
本文介绍了在另一个应用程序中获取当前关注的控件的句柄的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人们将如何检索当前具有焦点的控件的句柄?我正在使用WH_KEYBOARD_LL捕获所有按键,并且我应该能够确定用户在哪个文本框中键入内容.捕获事件的代码无法直接访问 其他应用程序中的控件.

How would one retrieve the handle of the control that currently has focus ? I am using WH_KEYBOARD_LL to capture all keypresses in, and I should be able to determine in which textbox the user is typing in. The code capturing the events has no direct access to the controls in the other application.

我知道存在win32函数GetFocus()来获取当前的窗口句柄,但是对于当前控件,我需要类似的东西.

I know the win32 function GetFocus() exists for getting the current window handle, but I need something similar for the current control.

任何想法都会受到赞赏.

Any ideas would be appreciated.

皮卡

推荐答案

您可以将GUI线程ID传递给

You can pass the GUI thread ID to GetGUIThreadInfo() which will provide you with a GUITHREADINFO.hwndFocus.

这篇关于在另一个应用程序中获取当前关注的控件的句柄的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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