1) You need to specify the ES_WANTRETURN style for the edit box. This is some option in the properties of the edit box in the dialog editor. If you don't do that the edit box will forward the enter to the dialog box which interprets it as click on the default button, usually closing the window.

2) If you look at the API documentation of the edit control you'll notice that there is no notification that informs you of a key being pressed. You have to subclass the edit control and intercept the WM_CHAR message. In MFC you do that by deriving a class from CEditCtrl and adding a control variable (through the wizard) to the dialog that is of the type of your derived class. In your classes message map you can then intercept WM_CHAR. Don't forget to forward the message, else the edit box will lose its functionality.

Btw, neither of those were MFC questions...