You could also look into inheriting from a CEdit class and write your own control. Then handle the WM_CHAR message and decide what you want to do with it. In a .h file you could have
class CFloatEdit : public CEdit
{
public:
afx_msg void OnChar(UINT nChar, UINT nRepCnt, UINT nFlags);
}
Then in your .cpp implementation file
afx_msg void CFloatEdit::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if (isdigit(nChar) || (nChar == '.') || (nChar < 0x20))
CEdit::OnChar(nChar, nRepCnt, nFlags);
else
MessageBeep(0xFFFFFFFF);
}
That's not a complete implementation, but gives you the general idea.