点击edit空间弹出字定义的键盘对话框,如何实现鼠标焦点不在该对话框时,销毁该对话框

解决方案 »

  1.   

    ::GetFocus()
    Return Values
    The handle to the window with the keyboard focus indicates success. NULL indicates that the calling thread’s message queue does not have an associated window with the keyboard focus. 看返回的句柄是不是对话框的
      

  2.   

    解决了
    加载以下函数:
    在CWnd::OnActivate消息中处理: 
    if(nState   ==   WA_INACTIVE) 

          PostNcDestory()  //失去焦点了,摧毁对话框 
    }
    这样当窗口不是当前窗口时,关闭该窗口。