我发送一个WM_SETTEXT消息,怎么OnSetText不能响应呢?
::SendMessage(m_hWnd,WM_SETTEXT,0,0);
void OnSetText()
{
AfxMessage("aa");//不转入执行这.为什么啊?
}

解决方案 »

  1.   

    The DefWindowProc function sets and displays the window text. For an edit control, the text is the contents of the edit control. For a combo box, the text is the contents of the edit-control portion of the combo box. For a button, the text is the button name. For other windows, the text is the window title. 
      

  2.   

    OnSetText 是映射到哪里的?
      

  3.   

    在BEGIN_MESSAGE_MAP中加入:ON_MESSAGE(WM_SETTEXT, OnSetText)
    OnSetText需要是窗口类的成员函数。
      

  4.   

    我加了也不行啊,就是不进去执行OnSetText.
      

  5.   

    关键是你在哪调用的这句,
    ::SendMessage(m_hWnd,WM_SETTEXT,0,0); 
    你把他放在哪了,他是否执行到了?
      

  6.   

    执行了啊.
    我是这样的:
    ::SendMessage(m_SysIPWnd,WM_SETTEXT,0,_T("192.168.0.1"));
    CIPAddressCtrl控件里的IP地址已经变成192.168.0.1了,但我想通过执行OnSetText,来执行另外的一些操作.但就是没有转入onSetText里执行.
      

  7.   

    m_SysIpWnd 是什么类有没有在PreTranslate函数中处理这个消息并不是定义了消息映射就能执行的,有时候消息传不到这个类
      

  8.   


    处理IPN_FIELDCHANGED 消息可能会对你有帮助