Vibhesh,
You have two options. The first is to override the PreProcessMessage
method on the Form that is hosting the controls. The second is to implement
the IMessageFilter interface and register it with the static
AddMessageFilter method on the Application class. If you do the latter,
then the implementation will be called before the messages are dispatched to
the form (the applications message loop will pass to registered message
filters first).
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
ni**************@exisconsulting.com
"Vibhesh" <Vi*************@windowmaker.com> wrote in message
news:49****************************@phx.gbl...
Hello,
I have designed a form in C#. There are several controls
on the form. I want to trap all the events at the form
level before they are passed on to the controls.
For eg : Suppose there are two buttons on the form. At any
moment one of the two buttons will be focused. When I
press any key I want to perform some default processing at
the Form level before the events are caught by the Buttons.
I want something simillar to what PreTranslateMessage does
for CWnd in MFC.
Thanks.