Detecting delete keypress in OnChar 
Author Message
 Detecting delete keypress in OnChar

My program checks to see what key was pressed in the OnChar function like
this:
switch(nChar)
{
case VK_RETURN:
    *user pressed enter key
case '\b':
    *user pressed backspace key
case VK_DELETE:
    *user pressed delete key

Quote:
}

The problem is for the delete key it only detects the delete key on the
numeric keypad.  That's not what I want, I want it to detect the other
delete key located under the insert key.

Any ideas?



Fri, 27 Oct 2000 03:00:00 GMT  
 Detecting delete keypress in OnChar



Quote:
>My program checks to see what key was pressed in the OnChar function like
>this:
>switch(nChar)
>{
>case VK_RETURN:
>    *user pressed enter key
>case '\b':
>    *user pressed backspace key
>case VK_DELETE:
>    *user pressed delete key
>}
>The problem is for the delete key it only detects the delete key on the
>numeric keypad.  That's not what I want, I want it to detect the other
>delete key located under the insert key.

>Any ideas?

The virtual key codes (VK_xxx) are for use with WM_KEYxxx messages,
not WM_CHAR. The Win32 SDK documentation has a lot of good information
on this sort of thing.

--
Doug Harrison



Fri, 27 Oct 2000 03:00:00 GMT  
 Detecting delete keypress in OnChar

Quote:
>My program checks to see what key was pressed in the OnChar function like
>this:
>switch(nChar)
>{
>case VK_RETURN:
>    *user pressed enter key
>case '\b':
>    *user pressed backspace key
>case VK_DELETE:
>    *user pressed delete key
>}
>The problem is for the delete key it only detects the delete key on the
>numeric keypad.  That's not what I want, I want it to detect the other
>delete key located under the insert key.

I've tried a quick test with Spy++ on Notepad and I never get a
WM_CHAR message for either delete key. If you handle WM_KEYDOWN and
check VK_DELETE there, it should work for both keys. If you need to
distinguish between the 2 keys you can check the fExtended flag.

Dave
----
Address is altered to discourage junk mail.
Please post responses to the newsgroup thread,
there's no need for follow up email copies.



Fri, 27 Oct 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. detect delete instead delete [ ]

2. Detecting A Keypress

3. Detecting keypress

4. HELP! Keypress detect

5. Detecting a keypress

6. How To Detect KeyPress.

7. Detecting keypress when the focus is on CButton

8. HOW TO: detect a keypress

9. Detect keypress in dialog-based

10. Trapping backspace and delete keys in KeyPress event

11. How can I trap Ctrl + Alt+ delete keypress in Win98

12. CEdit::OnChar()

 

 
Powered by phpBB® Forum Software