MFC怎么实现编辑框回车输入数据

因为现在要交课程设计,暂时没时间系统学习mfc,不太理解其中的工作原理。
做的是一个成绩统计系统,输入8个成绩,输出个分数段人数。界面如下:
图片说明
现在在就是想实现在输入框输入成绩后按回车,可以完成本次输入、清空编辑框再进行下一次输入。网上说是重写PreTranslateMessage:

 BOOL CGradeStatisticDlg::PreTranslateMessage(MSG* pMsg) 
{
        if(pMsg->message==WM_KEYDOWN && pMsg->wParam==VK_RETURN) 
        {
            p[i] = m_score; //m_score 为编辑框对应的cstring类型变量
            m_score="0x0D";
            i++;
            UpdateData(true);
            return true;
        } 
        return CDialog::PreTranslateMessage(pMsg);
}

然后请问重写完后要怎么在主程序中加入它呢?
主程序为

 #include <windows.h>
#include <string.h>
#include "stdafx.h" 
#include "resource.h"



HINSTANCE hInstance;

LRESULT CALLBACK _ProcDlgMain(HWND hwnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
 {              BOOL szBuffer;
                int a1;
                short a2;
                int i, b[8];
                int q[6];
                HICON hc;
        if(uMsg == WM_CLOSE)
            EndDialog(hwnd,NULL);
        else if(uMsg == WM_COMMAND) 
        {   a1=wParam;
            a2=a1;
            if(a2 == B2)
                EndDialog(hwnd,NULL);
            else if (a2 == B1)      
            {
                    for (int j=0; j<8; j++) b[j]=89;        //b为输入成绩,q为统计成绩
                    for(i=0;i<6;i++)        q[i]=0;

                    __asm{              
                                mov ecx, 8
                                mov edi, 0
                        again:
                                mov edx, b[edi*4]
                                cmp edx, 60
                                jb  below60
                                cmp edx, 70
                                jb  below70
                                cmp edx, 80
                                jb  below80
                                cmp edx, 90
                                jb  below90
                                cmp edx, 100
                                jb  below100
                        equal100:   
                                inc q[5*4]
                                jmp done
                        below60:
                                inc q[0*4]
                                jmp done
                        below70:
                                inc q[1*4]
                                jmp done
                        below80:    
                                inc q[2*4]
                                jmp done
                        below90:
                                inc q[3*4]
                                jmp done
                        below100:
                                inc q[4*4]
                        done:
                                inc edi
                                loop again
                    }  
                    SetDlgItemInt(hwnd,E1,q[0],TRUE);
                    SetDlgItemInt(hwnd,E2,q[1],TRUE);
                    SetDlgItemInt(hwnd,E3,q[2],TRUE);
                    SetDlgItemInt(hwnd,E4,q[3],TRUE);
                    SetDlgItemInt(hwnd,E5,q[4],TRUE);
                    SetDlgItemInt(hwnd,E6,q[5],TRUE); 
              }
        }
        else
            return FALSE;

        return TRUE;
}

int _stdcall WinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPSTR lpCmdLine,int nCmdShow)
{       hInstance=GetModuleHandle(NULL);
        DialogBoxParam(hInstance,(LPCTSTR)D1,NULL,(DLGPROC)_ProcDlgMain,NULL);
        ExitProcess(NULL);
}
 你的主程序不是mfc的,而是win32 sdk的。

所以不需要重写什么PreTranslateMessage
写在你的CALLBACK _ProcDlgMain里面就可以了

在
if(uMsg == WM_CLOSE)
            EndDialog(hwnd,NULL);
下面
else if(uMsg==WM_KEYDOWN && wParam==VK_RETURN)
{
    keybd_event(vk_tab,0,0,0);
 keybd_event(vk_tab,0,KEYEVENTF_KEYUP,0);
 }

我在 SetDlgItemInt(hwnd,E6,q[5],TRUE); } 后加了如下代码:

        else if (uMsg == WM_KEYDOWN && wParam == VK_RETURN)
        {   keybd_event(VK_RETURN, 0, 0, 0);
                //keybd_event(VK_RETURN, 0, KEYEVENT_KEYUP, 0);
                char str[4];
                GetDlgItemText(hwnd, IDC_EDIT1, str, 4);    //录入编辑狂数据
                SetDlgItemText(hwnd, IDC_EDIT1, "");         //清空编辑框
                b[j] = _ttoi(str);
        }

可是按回车还是没反应。还有就是为什么要加keybd_event()?
那个KEYEVENT_KEYUP也是未声明的。