Re: how to set application-wide keyboard handling? by Stoitcho
Stoitcho
Tue Oct 19 09:33:37 CDT 2004
Other possibility would be install a message filter. Take a look on
IMessageFilter and Application.AddMessageFilter. In this case, however, you
deal with windows messages rather than events. Pay attention on the CAUTION
section in the docs. It says that isntalling message filter can hurt the
performance.
This is the only place where you can intercept windows notifications
globally for the UI thread. But be adviced that you can catch only events
that comes thru the message pump (those are more or less messages form the
keyboard and the mouse). Most of the messages are sent and they don't go
thru the message queue
--
HTH
Stoitcho Goutsev (100) [C# MVP]
"Rajesh R" <rajesh_re@trigent.com> wrote in message
news:%23zGOZPdtEHA.2688@TK2MSFTNGP14.phx.gbl...
> Not sure whether I have understood correctly. But can't you write a base
> form in which you capture the KeyPress event and derive all the other
> forms
> from the base form?
>
> +Rajesh R
>
> "assaf" <assafwo@hotmail.com> wrote in message
> news:eZpcU2ctEHA.2664@TK2MSFTNGP12.phx.gbl...
>> hi all
>>
>> i have a 2 winforms in my app.
>> one is the owner of the other.
>>
>> i capture keyboard events for
>> each form.
>>
>> can i instead tell the entire 'app'
>> to respond to certain keys.
>> and not have to tell each form to handle the keys.
>>
>> i actually have over 20 forms,
>> so handling keys for each form
>> would be a lot of dirty work.
>>
>>
>> assaf
>>
>>
>>
>>
>
>