My windows form application has IMessageFilter functionality. It seems to work except for that it captures key events that are meant to be for input into a textbox.
Is there any way to get around this?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you implement IMessageFilter, and call Application.AddMessageFilter(), then you see all of the queued input messages for every control on every form that you created. That’s entirely the point of using the interface. You could filter, as suggested by the method name, the PreFilterMessage() method supplies the control’s window handle in the Message.HWnd argument. Which you can compare to a specific control’s Handle property. Or you can use Control.FromHandle() to get a reference to the control that’s going to get the message. Return
falsefrom the method to prevent the message from getting further processed.