如图 现在能把EDIT覆盖到指定编辑位置 如何通过判断ENTER键按下保存当前修改的内容

如图 现在能把EDIT覆盖到指定编辑位置 怎么通过判断ENTER键按下保存当前修改的内容?
写了两个函数都没能成功 按下enter键后没什么反应 好像没能截获到enter键被按下的消息 两个函数的代码如下 大家看看是哪错了?
C/C++ code
void xscj::OnOK() 
{   
    CWnd* pwndCtrl = GetFocus();
    // get the control ID which is 
    // presently having the focus
    int ctrl_ID = pwndCtrl->GetDlgCtrlID();
    CString str;
    switch (ctrl_ID)
    {   //if the control is the EditBox 
        CWnd* pwndCtrl = GetFocus();
        // get the control ID which is 
        // presently having the focus
        int ctrl_ID = pwndCtrl->GetDlgCtrlID();
        CString str;
        switch (ctrl_ID)
        {   //if the control is the EditBox 
        case IDC_EDIT6:
            //get the text from the EditBox
            GetDlgItemText(IDC_EDIT6,str);
            //set the value in the listContorl with the
            //specified Item & SubItem values
            m_list.SetItemText (nItem,nSubItem,str);
            ::SendDlgItemMessage(m_hWnd,IDC_EDIT6,
                WM_KILLFOCUS,0,0);
            ::ShowWindow(::GetDlgItem(m_hWnd,IDC_EDIT6),SW_HIDE);
            break;     
        default:
            break;
        }
    }
}

另一个函数
C/C++ code
BOOL xscj::PreTranslateMessage(MSG* pMsg) 
{
    // TODO: Add your specialized code here and/or call the base class
    /*if(pMsg->message==WM_KEYDOWN   &&   pMsg->wParam==VK_RETURN)
    {
        if(pMsg-> wParam==VK_RETURN) 
        {
        CString str;
        GetDlgItemText(IDC_EDIT6,str);
        m_list.SetItemText (nItem,nSubItem,str);
        ::ShowWindow(::GetDlgItem(m_hWnd,IDC_EDIT6),SW_HIDE);
        }
    }*/
    if   (   pMsg   ->   message   ==   WM_KEYDOWN   )
    {
        if   (   (   pMsg   ->   wParam   &   0xff   )   ==   VK_RETURN   )
        {
            if   (   GetFocus()   ->   GetDlgCtrlID()   ==  m_Edit.GetDlgCtrlID ()   )
            {
                CString str;
                GetDlgItemText(IDC_EDIT6,str);
                m_list.SetItemText (nItem,nSubItem,str);
                ::ShowWindow(::GetDlgItem(m_hWnd,IDC_EDIT6),SW_HIDE);

                
            }
        }
    }
    
    return CDialog::PreTranslateMessage(pMsg);
}



------解决方案--------------------
GetSel、SetSel、ReplaceSel
按下enter建,可以通过响应失去焦点消息