Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all,
I want to use a keyboard hook to destroy a message, example I want to destroy event press 'a' in EditBox (MFC), not allow to press 'a' from keyboard in this EditBox, how to do this? Please help me. Thank in advance.
Posted
Updated 28-Apr-11 18:04pm
v2

You don't need a Hook to filter events coming to a editor control (as this is MFC, did you mean CEdit?). You can do it all processing messages.
Please see this example:
http://support.microsoft.com/kb/92394[^].

—SA
 
Share this answer
 
Comments
Niklas L 29-Apr-11 3:45am    
Good link to a simple solution. Consider yourself fived.
Sergey Alexandrovich Kryukov 29-Apr-11 3:56am    
Thank you, Niklas; I'll try to :-)
--SA
Andrewpeter 2-May-11 10:22am    
Thank you for your sharing!
Sergey Alexandrovich Kryukov 2-May-11 14:25pm    
Will it work for you?
If so, will you formally accept the answer (green button)?
If not, you're follow-up questions are welcome.
--SA
You could also achieve this with a masked edit control, such as CMFCMaskedEdit[^] or maybe COXMaskedEdit[^].
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 29-Apr-11 3:57am    
Can be a better alternative, in some cases much better, depending on what are the constraints for the text to be input. My 5.
--SA
Andrewpeter 2-May-11 10:22am    
Thank you for your sharing!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900