vsulu
asked on
How to find the ascii values for SHIFT+ KEYS
I want to find the acii value for the shift+keys.
I have edit controls in my project and i want to allow the entry of
numbers alone and "." for decimal point,so this my coding i have
done in the pretranslatemessage().
BOOL CTrans::PreTranslateMessag e(MSG* pMsg)
{
// TODO: Add your specialized code here and/or call the base class
char q[10];
::GetClassName(::GetFocus( ),q,10);
if(strcmp(q,"Edit")==0)
{
CWnd* ww = GetFocus();
switch(pMsg->message)
{
case WM_KEYDOWN:
{
CString str;
ww->GetWindowText(str);
if(pMsg->wParam==190 && str.Find(".",0) ==-1)
return CDialog::PreTranslateMessa ge(pMsg);
if(pMsg->wParam ==9 ||pMsg->wParam ==27||pMsg-
>wParam >= 36 && pMsg->wParam <= 39 || pMsg-
>wParam==8) return CDialog::PreTranslateMessa ge
(pMsg);
if(!isdigit(pMsg->wParam))
if(!(pMsg->wParam==46|| pMsg->wParam==8))
return true;
)
}
}
return CDialog::PreTranslateMessa ge(pMsg);
}
for the key 1 to 0 and for the . key when i use the shift keys !,@,#,$,%,^,&,*,(,),> are entered in the edit control I don't want the shift+key operation to work.
help me regarding this.
I have edit controls in my project and i want to allow the entry of
numbers alone and "." for decimal point,so this my coding i have
done in the pretranslatemessage().
BOOL CTrans::PreTranslateMessag
{
// TODO: Add your specialized code here and/or call the base class
char q[10];
::GetClassName(::GetFocus(
if(strcmp(q,"Edit")==0)
{
CWnd* ww = GetFocus();
switch(pMsg->message)
{
case WM_KEYDOWN:
{
CString str;
ww->GetWindowText(str);
if(pMsg->wParam==190 && str.Find(".",0) ==-1)
return CDialog::PreTranslateMessa
if(pMsg->wParam ==9 ||pMsg->wParam ==27||pMsg-
>wParam >= 36 && pMsg->wParam <= 39 || pMsg-
>wParam==8) return CDialog::PreTranslateMessa
(pMsg);
if(!isdigit(pMsg->wParam))
if(!(pMsg->wParam==46|| pMsg->wParam==8))
return true;
)
}
}
return CDialog::PreTranslateMessa
}
for the key 1 to 0 and for the . key when i use the shift keys !,@,#,$,%,^,&,*,(,),> are entered in the edit control I don't want the shift+key operation to work.
help me regarding this.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I will leave a recommendation in the Cleanup topic area that this question is:
Answered by : migel, aphillips (points to be split)
Please leave any comments here within the next seven days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Roshan Davis
EE Cleanup Volunteer