Click here to Skip to main content
15,908,841 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi.
Looking for a way to intervene between the TranslateMessage function and Window function for a TextBox. Want to catch the character for control and if not accepted discard the character.
I do not want to bypass the TranslateMessage function.

Thanks for any help
Posted
Updated 2-Nov-13 19:38pm
v2
Comments
BillWoodruff 3-Nov-13 10:21am    
Is this WPF ? WinForms ? ... or ?

What Events of the TextBox Control do you handle now, and what is the relationship of the TextBox to the "TranslateMessage" function ?
Sergey Alexandrovich Kryukov 3-Nov-13 12:00pm    
This is not related to TranslateMessage or its bypassing. All TextBox controls have a mechanism for cancellation, just find it.
When you say "TextBox", the question is: which one? Full type name, please.
You really need to tag the UI library/framework or application type your are using, when UI is involved.
—SA
pluss400 7-Nov-13 12:39pm    
It´s unsafe direct against win api. Catching keybord low level event, it translates key kodes beföre the textbox get a caracter posted.
Sergey Alexandrovich Kryukov 7-Nov-13 13:12pm    
What is unsafe and why? TranslateMessage is unsafe, because it goes beyond .NET and requires P/Invoke. Handling KeyPress is the standard .NET way. Do you need any help with that? Please explain your goal or desired behavior.
—SA

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