There is an MFC defined way of doing this which means you don't have to check for the correct controls in a muti-control dialog etc.
All you need to do to get the Tab to work in an edit control of a dialog is override the WM_GETDLGCODE message which is sent to all controls in a dialog box. The solution isn't available via ClassWizard.
Create your control in the Resource Editor.
Derive a class from CEdit, and add the handler to the header...
class CTabEdit : public CEdit
afx_msg UINT OnGetDlgCode();
...and the function body to the .cpp...
// NOTE - the ClassWizard will add and remove mapping macros here.
I have an Edit Control in VC++, and I basically use it for logging. So I assign the member variable to the log info I want and then I use the UpdateData(FALSE).
Now the problem I have is I want the new line character to function as new line, but instead it displays some special character there. How do I send a new line character to my Edit Control.
I found this solution to be quite helpful, as in my application I needed a simple way to enter script-language syntax. However I ran into a slight problem. Because this solution captures all of the <TAB> key events, if there are other controls on the window then it is no longer possible to <TAB> from one to the other.
The solution to this is quite simple. In pre-translate message, just check to see if your edit control has the input focus: