如题,因为如果在对话框中的编辑框中输入文字时按回车就会出现怎个对话框被刷为背景所有控件不可见的情况,所以想屏蔽回车键。

解决方案 »

  1.   

    两个常用办法
    1、重载OnOK()函数,让它什么事情也不干
    2、重载PreTranslateMessage
      

  2.   

    BOOL CMycomboDlg::PreTranslateMessage(MSG* pMsg) 
    {
    // TODO: Add your specialized code here and/or call the base class
    if (pMsg->message == WM_KEYDOWN)
    {

    int nVirtKey = (int) pMsg->wParam;
    if (nVirtKey == VK_RETURN)  
    your code ....
      

  3.   

    if(pMsg->message == WM_KEYDOWN)
    if( int(pMsg->wParam) == VK_ESCAPE || int(pMsg->wParam) == VK_RETURN) //屏蔽ESC和 ENTER
    return TRUE;
      

  4.   

    http://blog.csdn.net/lixiaosan/archive/2006/04/11/658248.aspx