> I am beginner in C#. I am writing an application which will monitor
> for all the events that are generated in my application and log it in
> a file. Is there any way to put a hook on message queue and achieve
> that or is there by any means i can subscribe my method to respond to
> all the events and then calling appropriate functions?
On Jan 24, 3:24 pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@poblacion.org> wrote:
> > I am beginner in C#. I am writing an application which will monitor
> > for all the events that are generated in my application and log it in
[quoted text clipped - 15 lines]
> This is not very pretty, but is much easier to do than trying to use
> Reflection to enumerate all of the events and hooking them on-the-fly.
Dear Alberto,
Thanks for your response. your first approach seems intresting
because later if i add another control to the form i dont need to put
my logging routine inside that event handler. I am right now intrested
in loging Button Click only. But i have one question suppose if i am
having a button and its event handler in the class and i am doing the
hook also. Will PreFilterMessage and MyEventHanlder will get called?
Alberto Poblacion - 24 Jan 2008 11:13 GMT
> [...] I am right now intrested
> in loging Button Click only. But i have one question suppose if i am
> having a button and its event handler in the class and i am doing the
> hook also. Will PreFilterMessage and MyEventHanlder will get called?
Yes. PreFilterMessage will be called first. Here you can examine the
message, and possibly cancel it. If you don't cancel the message, it will
reach the Form class, which will send it to the Button object, and the
Button will in turn raise its Click event, which will then call your
MyEventHanlder.
Nash - 25 Jan 2008 11:16 GMT
On Jan 24, 4:13 pm, "Alberto Poblacion" <earthling-
quitaestoparacontes...@poblacion.org> wrote:
> > [...] I am right now intrested
> > in loging Button Click only. But i have one question suppose if i am
[quoted text clipped - 6 lines]
> Button will in turn raise its Click event, which will then call your
> MyEventHanlder.
thanks alberto it really helped me.