Filter messages
-
Hi! I have created a similar thread before and I was not able to find a possible solution. Here is the issue again. I need someplace where I can filter all messages of the application (main form and all child forms). I have implemented message filters but somehow the child modal dialogs does not seem to have message filtered (there messages do not come into the filter).
-
Hi! I have created a similar thread before and I was not able to find a possible solution. Here is the issue again. I need someplace where I can filter all messages of the application (main form and all child forms). I have implemented message filters but somehow the child modal dialogs does not seem to have message filtered (there messages do not come into the filter).
MSDN link[^] I'm sure someone has mentioned Application.AddMessageFilter Method. Its exactly what you need. The following example traps all left-button mouse activity:
#region IMessageFilter Members
public bool PreFilterMessage(ref Message m)
{
if (m.Msg >= 513 && m.Msg <= 515)
{
System.Diagnostics.Trace.WriteLine("Caught");
return true;
}
return false;
}
#endregionIf you have any problems post back. This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy
-
MSDN link[^] I'm sure someone has mentioned Application.AddMessageFilter Method. Its exactly what you need. The following example traps all left-button mouse activity:
#region IMessageFilter Members
public bool PreFilterMessage(ref Message m)
{
if (m.Msg >= 513 && m.Msg <= 515)
{
System.Diagnostics.Trace.WriteLine("Caught");
return true;
}
return false;
}
#endregionIf you have any problems post back. This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy