G
Guest
Hi,
I recently had a post about how to block Mousewheel events. The answer was
to implement an IMessageFilter. Sadly, I must report that after 24 hours of
researching my library and online resources I am still stumped! I did find a
promising code snippet on MSDN, but have yet to successfully implement it.
Here is the code snippet:
Public Class MessageFilter
Public Class TestMessageFilter
Implements IMessageFilter
Public Function PreFilterMessage(ByRef m As _
System.Windows.Forms.Message) _
As Boolean Implements IMessageFilter.PreFilterMessage
'Blocks all the messages relating to the left mouse button.
If ((m.Msg >= 513) And (m.Msg <= 515)) Then
Console.WriteLine("Process messages: " & m.Msg)
Return True
End If
Return False
End Function
End Class
End Class
I have three basic questions about this code. 1.) How do I specify the
parameter ‘m’ when I call the PreFilterMessage function? 2.) Where in my
code do I insert the PreFilterMessage function? 3.) Where to the constants
513 and 515 in the ‘If’ statement come from and how must I change this to
block messages relating to the Mousewheel?
Thanks for your assistance and patience.
I recently had a post about how to block Mousewheel events. The answer was
to implement an IMessageFilter. Sadly, I must report that after 24 hours of
researching my library and online resources I am still stumped! I did find a
promising code snippet on MSDN, but have yet to successfully implement it.
Here is the code snippet:
Public Class MessageFilter
Public Class TestMessageFilter
Implements IMessageFilter
Public Function PreFilterMessage(ByRef m As _
System.Windows.Forms.Message) _
As Boolean Implements IMessageFilter.PreFilterMessage
'Blocks all the messages relating to the left mouse button.
If ((m.Msg >= 513) And (m.Msg <= 515)) Then
Console.WriteLine("Process messages: " & m.Msg)
Return True
End If
Return False
End Function
End Class
End Class
I have three basic questions about this code. 1.) How do I specify the
parameter ‘m’ when I call the PreFilterMessage function? 2.) Where in my
code do I insert the PreFilterMessage function? 3.) Where to the constants
513 and 515 in the ‘If’ statement come from and how must I change this to
block messages relating to the Mousewheel?
Thanks for your assistance and patience.