如何获得有关文本框焦点的通知? [英] How to get notified of textbox focus?
问题描述
使用Windows 7触摸设备,当您对文本框或某种类型的输入字段(记事本等)进行标签/调整时,Windows会显示此触摸键盘小指示器(单击该标签会显示屏幕键盘上的触摸).
我想编写一个应用程序,该应用程序将在发生这种情况时得到通知,而文本框(等等)将成为焦点(无论哪个应用程序).
是否已通知应用程序专注于其他应用程序,我是否需要挂钩?
在c ++中有办法吗?
我相信 解决方案
I believe the SetWinEventHook function and specifically the EVENT_OBJECT_FOCUS
event is what you are looking for.
From the MSDN description:
An object has received the keyboard focus. The system sends this event for the following user interface elements: list-view control, menu bar, pop-up menu, switch window, tab control, tree view control, and window object. Server applications send this event for their accessible objects.
The hwnd parameter of the WinEventProc callback function identifies the window that receives the keyboard focus.
这篇关于如何获得有关文本框焦点的通知?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!