简体   繁体   English

如何使用Win32 API在“模态”对话框中立即知道哪个控件窗口获得了焦点?

[英]How to know which control window got focus right now in Modal dialog using Win32 API?

I am trying to do something with the Modal dialog in Win7. 我正在尝试使用Win7中的“模态”对话框进行操作。 To do that I need to know which control window has got focus right now by using Win32 API. 为此,我需要使用Win32 API来了解哪个控件窗口现在已经成为焦点。 If I could know which control is now got focus then I can send message to this window to do some specific task. 如果我现在知道哪个控件已成为焦点,则可以向该窗口发送消息以执行某些特定任务。

Could any one suggest me how should I know which control has got focus right now using win 32? 谁能建议我如何知道现在使用win 32哪个控件获得了焦点?

If you want to know which window has keyboard focus and you're only interested in windows belonging to your own thread use GetFocus . 如果您想知道哪个窗口具有键盘焦点,并且只对属于自己线程的窗口感兴趣,请使用GetFocus

Finding out which window in the entire system has focus requires a few steps: 要找出整个系统中哪个窗口具有焦点,需要执行以下步骤:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM