PreProcessMessage

  • Thread starter Thread starter AndyPowell
  • Start date Start date
A

AndyPowell

Does anyone know how to use this method on a Form or a Control? I've tried
overriding it and it never seems to get called. Am I missing something?

I want to intercept mouse messages to stop them being sent to sub-controls -
similar to design time controls in VS.
 
Hi Andy,
PreProcessMessage works only for keyboard messages. Furthermore, it is
called only for the messages sent to the control overriding the method. For
example if you create a form overriding PreProcessMessage and place a button
on the form the form's PreProcessMessage won't be called. That is because
the button has the input focus and you cannot set the focus to the form.
Button's PreProcessMessage is called instead.

IMHO overriding WndProc won't do the trick for you either. In your case what
you might want to do is to register message filter with the Application
class (Application.AddMessageFilter) and filter the messages on that level.

HTH
B\rgds
100
 
Back
Top