从被点击的按钮上移除焦点 [英] remove focus from a button which was clicked

查看:42
本文介绍了从被点击的按钮上移除焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我点击一个按钮时,焦点被设置在这个按钮上.

When I click a button the focus is set to this button.

如何使用 C++ 中的 WIN API 移除此按钮的焦点?

How do I remove the focus from this button with WIN API in C++?

我认为也许以某种方式使用 SendMessage WIN API 方法可以从按钮上移除焦点.

I think maybe somehow with the SendMessage WIN API method it is possible to remove the focus from the button.

我只有按钮的句柄,也无法再访问父窗口.

I have only the handle of button, also I cannot access the parent window anymore.

我知道几乎每次都可以使用::SetFocus,但是这次我无法使用它,因为即使找到句柄也无法访问窗口窗体.所以请提出其他解决方案.

I know that almost everytime it is possible to use ::SetFocus, but this time I cannot use it since I cannot access the window form even if I find the handle. So please suggest other solutions.

推荐答案

您只需调用 ::SetFocus(或 CWnd::SetFocus如果您使用的是 MFC)和所需窗口的句柄/指针.

You simply put the focus on another window by calling ::SetFocus (or CWnd::SetFocus if you are using MFC) with the desired window's handle/pointer.

这篇关于从被点击的按钮上移除焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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