there are many way to do this.
one resusable way is that.
Create your class (CHexEdit) derived from CEdit
override the PreTranslateMessage() function in CHexEdit class
do following kind of checking in it
if( pMsg->message == WM_CHAR )
{
if(( pMsg->wParam != 'A' ) )
{
pMsg->wParam = 0;
}
}
instead of if(( pMsg->wParam != 'A' ) ) you need to write your own condition checking for allowing characters only between 0 and 9 and 'a' and 'f' and 'A' and 'F' to support hexadecimal
now you have to create control meber variable of your edit control.its class type should be HexEdit instead of CEdit