PreFilterMessage is not called when hosting C# control within Internet Explorer

2.1k Views Asked by At

Here is a sample: 1. Create a class 'public class RichTextBoxEx : RichTextBox, IMessageFilter'. 2. Implement 'public bool PreFilterMessage(ref Message m)'. 3. Enter into edit mode of the control and type any text.

The result is as describe above... the 'PreFilterMessage' is not called when the control is hosted within the browser. Also by giving the FullTrust access to control the PreFilterMessage is not getting called

1

There are 1 best solutions below

0
On

Not all messages are passed through the PreMessageFilter mechanism. Only the messages that are posted to your control are filtered - direct messages are not filtered.

Override the WndProc() function to filter all kinds of messages.