Thank you so much for your reply.
Jeffrey Tan[MSFT] wrote:
> Hi paulo,
>
> Thanks for your post!
>
> IMessageFilter is not a reliable way to catch all the messages in the
> application. Actually, IMessageFilter is preprocessing before the normal
> translate/dispatch cycle of the message pump, and it will only see posted
> messages. The messages that pass to the Windows procedure through
> SendMessage method will not be placed in the message pump, so the
> IMessageFilter will not see them.
>
> If you only want to catch all the messages to the main Form, you may
> override Form class's WndProc method. Normally all the messages to Form
> class will first pass this method first. However, in your scenario, the
> TextBoxes themselves are separate windows, they have their own WndProc, so
> the focus messages of TextBoxes will not be passed to Form's WndProc, while
> are passed to TextBoxes' WndProc.
>
> The only reliable way to catch all the messages in a Winform application is
> Windows Message Hook. You can install a WH_GETMESSAGE to the main GUI
> thread of your application, and then you will get all the messages in your
> main GUI thread. Because this is a Local Windows Hook, there is no need to
> write the hook procedure in a dll, you can just use p/invoke in C# to get
> this done. Please refer to the KB below:
> "How to set a Windows hook in Visual C# .NET"
>
http://support.microsoft.com/kb/318804/en-us >
> Hope this helps!
>
> Best regards,
> Jeffrey Tan
> Microsoft Online Community Support
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
> This posting is provided "AS IS" with no warranties, and confers no rights.
>