EditBox control Problem
-
I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .
-
I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .
For that you need to implement your own EditBox, like the example given ( Create your own controls - the art of subclassing[^]) And inside which you u have overiride the PreTranslateMessage. eg:-
BOOL MyEditCtrl::PreTranslateMessage(MSG* pMsg)
{
// disable mouse and keyboard copy
switch( pMsg->message )
{
case WM_KEYDOWN:
{
switch( pMsg->wParam )
{
case 0x56:
{
if( GetKeyState(VK_CONTROL) )
return true;
}
break;
}
}
break;case WM\_RBUTTONDOWN: { return true; } break; } return CMyEdit::PreTranslateMessage(pMsg);
}
Величие не Бога может быть недооценена.
-
I have added a EditBox control to a Dialog and i have selected the property(number : true,VC++ 2005). i have validated, only number can be entered.if user enters characters it will not accept,ok it works fine.But when user copy some text and paste in EditBox it is accepting i am getting strange output. please help how to stop copy and paste text or any character in EditBox .