Link to home
Start Free TrialLog in
Avatar of vsulu
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::PreTranslateMessage(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::PreTranslateMessage(pMsg);
          if(pMsg->wParam ==9 ||pMsg->wParam ==27||pMsg-
           >wParam >= 36 && pMsg->wParam <= 39 || pMsg-
           >wParam==8) return CDialog::PreTranslateMessage
           (pMsg);
                 
     if(!isdigit(pMsg->wParam))
     if(!(pMsg->wParam==46|| pMsg->wParam==8))
      return true;
     )
                 
          }
     }
     
     return CDialog::PreTranslateMessage(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.
ASKER CERTIFIED SOLUTION
Avatar of migel
migel

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
No comment has been added lately, so it's time to clean up this TA.
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