MFC使控件失去焦点的方法

来源:互联网 发布:匹克淘宝 编辑:程序博客网 时间:2024/05/16 23:43

转自:http://newthnote.blogbus.com/logs/67403982.html

 

1.SetFocus另外一个控件

         GetDlgItem(另一个控件名)->SetFocus();

2.给要失去焦点的控件发WM_KILLFOCUS消息
        GetDlgItem(要失去焦点的控件名)->PostMessage(WM_KILLFOCUS, 0, 0);
        ::SendMessage(GetDlgItem(要失去焦点的控件名)-> m_hWnd,WM_KILLFOCUS,-1,0);
        SendDlgItemMessage(要失去焦点的控件名,WM_KILLFOCUS,0,0);

原创粉丝点击