ON_NOTIFY(NM_RETURN, IDC_LIST4, OnReturnList4)
加了這個入口,對不對呢?
可是一按回車就退出了,重載OnOK,也不行. 

解决方案 »

  1.   

    You need to handle the WM_GETDLGCODE message to indicate which keys to forward to OnKeyDown:UINT MyRowList::OnGetDlgCode()
    {
        return CListCtrl::OnGetDlgCode() | DLGC_WANTALLKEYS;
    }
      

  2.   

    把 deafult button 去掉看看。
      

  3.   

    to saucer:
    出現這兩條錯誤:error C2248: 'OnGetDlgCode' : cannot access protected member declared in class 'CWnd'
            D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxwin.h(2387) : see declaration of 'OnGetDlgCode'
    F:\work\Dlg\DlgDlg.cpp(621) : error C2352: 'CWnd::OnGetDlgCode' : illegal call of non-static member function
            D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxwin.h(2387) : see declaration of 'OnGetDlgCode'
      

  4.   

    to saucer:
    出現這兩條錯誤:error C2248: 'OnGetDlgCode' : cannot access protected member declared in class 'CWnd'
            D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxwin.h(2387) : see declaration of 'OnGetDlgCode'
    F:\work\Dlg\DlgDlg.cpp(621) : error C2352: 'CWnd::OnGetDlgCode' : illegal call of non-static member function
            D:\Program Files\Microsoft Visual Studio\VC98\MFC\INCLUDE\afxwin.h(2387) : see declaration of 'OnGetDlgCode'
      

  5.   

    重载CDialog的PreTranslateMessage(),发现是回车键就直接返回FALSE,否则调用父类的PreTranslateMessage()。
      

  6.   

    重载CDialog的PreTranslateMessage(),如果是回车键立刻返回FALSE,否则调用父类的PreTranslateMessage。
      

  7.   

    my code was meant for you to derive your own class from CListCtrl