|
-
April 30th, 1999, 07:16 AM
#1
Please HELP onchar() problem
Hai ,
I am using onchar() to catch what key is pressed , i need to set one variable if an alphabet is pressed .
In onchar() , the value we got is character code , we can do checking with VK_A ..... VK_Z .. so 27 checking is needed , is there any ohter way like VK_A has HEX value 41 ...VK_Z has 5A so what i did is if( nChar>41 && nChar< 5A) then setting my variable but it is giving error like 'bad suffic format'
i know i am comparing UINT and hex but i don't know how to correct this
please help me.
bye
-
April 30th, 1999, 11:54 AM
#2
Re: Please HELP onchar() problem
Hi.
If you want to catch A~Z, try this format.
if((nChar >= 65) && (nChar <= 90))
{
Your job here.
}
HTH.
-Masaaki Onishi-
-
April 30th, 1999, 01:43 PM
#3
Re: Please HELP onchar() problem
If you want to use the Hex value... Just place 0x in front of the value:
if (nChar > 0x40 && nChar < 0x5B)
But why not just use:
if (nChar >= VK_A && nChar <= VK_Z)
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
-
May 3rd, 1999, 06:31 AM
#4
Re: Please HELP onchar() problem
thanx a lot , i want to know when this onchar() will be called , i debugged , the code is not reachable , if i press 'a' from keyboard , this calls onchar() please tell me when onchar () will be called and what way this is useful
bye
thanx a lot
ammu
-
May 3rd, 1999, 02:10 PM
#5
Re: Please HELP onchar() problem
Hi
(Please go to the top of the page and edit your profile, so we can have a name for you instead of Anonymous)
It all depends on where you're trying to get the keyboard input... What are you doing? Is this in a view, in a dialog with an edit control?
If you're trying to look for certain keystrokes in an edit control, then one would subclass the CEdit control (derive your own class from CEdit) and catch OnChar() there.
I have an example on my web site which shows how to derive a class from CEdit.
Go to http://home.earthlink.net/~railro/mfc_link.html and check out Example 5.
Rail
Recording Engineer/Software Developer
Rail Jon Rogut Software
[email protected]
http://home.earthlink.net/~railro/
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|