PC Review


Reply
Thread Tools Rate Thread

capture all events?

 
 
Erik Frey
Guest
Posts: n/a
 
      5th Sep 2003
Hi there,

Just curious as to whether there's a clever way to see the events a
control/object is firing off, perhaps written out to the debug console. It
would be really handy to know which events a control is firing when I
perform a certain action, and the order in which they are occurring.

Thanks,

Erik


 
Reply With Quote
 
 
 
 
Stephany Young
Guest
Posts: n/a
 
      5th Sep 2003
Put a concole.writeline in an eventhandler for every event for the object in
question.

"Erik Frey" <(E-Mail Removed)> wrote in message
news:OxI$(E-Mail Removed)...
> Hi there,
>
> Just curious as to whether there's a clever way to see the events a
> control/object is firing off, perhaps written out to the debug console.

It
> would be really handy to know which events a control is firing when I
> perform a certain action, and the order in which they are occurring.
>
> Thanks,
>
> Erik
>
>



 
Reply With Quote
 
Erik Frey
Guest
Posts: n/a
 
      5th Sep 2003
I was wondering if there was a -clever- way of doing it, dynamic for an
object you choose.

My initial thoughts were to use reflection to loop through all the event
signatures - I imagine you can do that. And adding a handler, with some
kind of dynamically created method? Maybe? I don't even know if such a
thing is possible.

"Stephany Young" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Put a concole.writeline in an eventhandler for every event for the object

in
> question.
>
> "Erik Frey" <(E-Mail Removed)> wrote in message
> news:OxI$(E-Mail Removed)...
> > Hi there,
> >
> > Just curious as to whether there's a clever way to see the events a
> > control/object is firing off, perhaps written out to the debug console.

> It
> > would be really handy to know which events a control is firing when I
> > perform a certain action, and the order in which they are occurring.
> >
> > Thanks,
> >
> > Erik
> >
> >

>
>



 
Reply With Quote
 
Stephany Young
Guest
Posts: n/a
 
      5th Sep 2003
Sometimes you just have to get down and dirty and write some code.

"Erik Frey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I was wondering if there was a -clever- way of doing it, dynamic for

an
> object you choose.
>
> My initial thoughts were to use reflection to loop through all the

event
> signatures - I imagine you can do that. And adding a handler, with some
> kind of dynamically created method? Maybe? I don't even know if such a
> thing is possible.
>
> "Stephany Young" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Put a concole.writeline in an eventhandler for every event for the

object
> in
> > question.
> >
> > "Erik Frey" <(E-Mail Removed)> wrote in message
> > news:OxI$(E-Mail Removed)...
> > > Hi there,
> > >
> > > Just curious as to whether there's a clever way to see the events

a
> > > control/object is firing off, perhaps written out to the debug

console.
> > It
> > > would be really handy to know which events a control is firing when I
> > > perform a certain action, and the order in which they are occurring.
> > >
> > > Thanks,
> > >
> > > Erik
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      5th Sep 2003
Stephany
I love that answer, did not look at the question :-)
Cor


 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      5th Sep 2003
Erik,
To dynamically create a method (class/Assembly) look at the
System.Reflection.Emit namespace. Word of advice, load the dynamic assembly
into a new AppDomain so you can unload it.

Alternatively you could use System.CodeDom to create a source module that
you later compile.

In either case you probably could have written a single module faster and
manually handle all the events! However! You would not have a cool utility
worth sharing, that would handle events out of any source. Of course if you
are going the cool utility route, be sure we can choose which events we want
handled! And post the utility on www.gotdotnet.com or someplace were the
rest of us can use it!

BTW: Dynamically handling events I think would be handy for utilities such
as www.nunit.org & www.csunit.org. Have an attribute that says this method
should raise this event. The tool would dynamically handle the event to be
certain it was raised. Similar to how they handles Exceptions.

Hope this helps
Jay

"Erik Frey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I was wondering if there was a -clever- way of doing it, dynamic for

an
> object you choose.
>
> My initial thoughts were to use reflection to loop through all the

event
> signatures - I imagine you can do that. And adding a handler, with some
> kind of dynamically created method? Maybe? I don't even know if such a
> thing is possible.
>
> "Stephany Young" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Put a concole.writeline in an eventhandler for every event for the

object
> in
> > question.
> >
> > "Erik Frey" <(E-Mail Removed)> wrote in message
> > news:OxI$(E-Mail Removed)...
> > > Hi there,
> > >
> > > Just curious as to whether there's a clever way to see the events

a
> > > control/object is firing off, perhaps written out to the debug

console.
> > It
> > > would be really handy to know which events a control is firing when I
> > > perform a certain action, and the order in which they are occurring.
> > >
> > > Thanks,
> > >
> > > Erik
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
CJ Taylor
Guest
Posts: n/a
 
      5th Sep 2003
You could also look into bubble eventing. basically have everything point
to a sub that has the signiture (sp?) of (sender as object, e as
system.eventargs) and just keep adding handlers to it.

Then when you call the event handler (as an event is fired) you could do

console.writeline(e.gettype().tostring()) which will tell you what kind of
event argument handler your dealing with. and from there, you can pretty
much do what you want, since most event handlers have like signitures (and
are almost all derived from System.EventArgs...)

How is that for 'clever'



"Erik Frey" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I was wondering if there was a -clever- way of doing it, dynamic for

an
> object you choose.
>
> My initial thoughts were to use reflection to loop through all the

event
> signatures - I imagine you can do that. And adding a handler, with some
> kind of dynamically created method? Maybe? I don't even know if such a
> thing is possible.
>
> "Stephany Young" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Put a concole.writeline in an eventhandler for every event for the

object
> in
> > question.
> >
> > "Erik Frey" <(E-Mail Removed)> wrote in message
> > news:OxI$(E-Mail Removed)...
> > > Hi there,
> > >
> > > Just curious as to whether there's a clever way to see the events

a
> > > control/object is firing off, perhaps written out to the debug

console.
> > It
> > > would be really handy to know which events a control is firing when I
> > > perform a certain action, and the order in which they are occurring.
> > >
> > > Thanks,
> > >
> > > Erik
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Erik Frey
Guest
Posts: n/a
 
      5th Sep 2003
Thanks for the advice - it looks like you were on the right track.
Someone pointed me to this:

http://www.codeproject.com/csharp/controlinspector.asp

It basically does what you describe. Pretty handy utility!

Erik

"Jay B. Harlow [MVP - Outlook]" <(E-Mail Removed)> wrote in message
news:uydTf%(E-Mail Removed)...
> Erik,
> To dynamically create a method (class/Assembly) look at the
> System.Reflection.Emit namespace. Word of advice, load the dynamic

assembly
> into a new AppDomain so you can unload it.
>
> Alternatively you could use System.CodeDom to create a source module that
> you later compile.
>
> In either case you probably could have written a single module faster and
> manually handle all the events! However! You would not have a cool utility
> worth sharing, that would handle events out of any source. Of course if

you
> are going the cool utility route, be sure we can choose which events we

want
> handled! And post the utility on www.gotdotnet.com or someplace were the
> rest of us can use it!
>
> BTW: Dynamically handling events I think would be handy for utilities such
> as www.nunit.org & www.csunit.org. Have an attribute that says this method
> should raise this event. The tool would dynamically handle the event to be
> certain it was raised. Similar to how they handles Exceptions.
>
> Hope this helps
> Jay
>
> "Erik Frey" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I was wondering if there was a -clever- way of doing it, dynamic for

> an
> > object you choose.
> >
> > My initial thoughts were to use reflection to loop through all the

> event
> > signatures - I imagine you can do that. And adding a handler, with some
> > kind of dynamically created method? Maybe? I don't even know if such a
> > thing is possible.
> >
> > "Stephany Young" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Put a concole.writeline in an eventhandler for every event for the

> object
> > in
> > > question.
> > >
> > > "Erik Frey" <(E-Mail Removed)> wrote in message
> > > news:OxI$(E-Mail Removed)...
> > > > Hi there,
> > > >
> > > > Just curious as to whether there's a clever way to see the

events
> a
> > > > control/object is firing off, perhaps written out to the debug

> console.
> > > It
> > > > would be really handy to know which events a control is firing when

I
> > > > perform a certain action, and the order in which they are occurring.
> > > >
> > > > Thanks,
> > > >
> > > > Erik
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Erik Frey
Guest
Posts: n/a
 
      5th Sep 2003
Thanks for the advice:

http://www.codeproject.com/csharp/controlinspector.asp

"CJ Taylor" <(E-Mail Removed)> wrote in message
news:e9$1CH%(E-Mail Removed)...
> You could also look into bubble eventing. basically have everything point
> to a sub that has the signiture (sp?) of (sender as object, e as
> system.eventargs) and just keep adding handlers to it.
>
> Then when you call the event handler (as an event is fired) you could do
>
> console.writeline(e.gettype().tostring()) which will tell you what kind of
> event argument handler your dealing with. and from there, you can pretty
> much do what you want, since most event handlers have like signitures (and
> are almost all derived from System.EventArgs...)
>
> How is that for 'clever'
>
>
>
> "Erik Frey" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > I was wondering if there was a -clever- way of doing it, dynamic for

> an
> > object you choose.
> >
> > My initial thoughts were to use reflection to loop through all the

> event
> > signatures - I imagine you can do that. And adding a handler, with some
> > kind of dynamically created method? Maybe? I don't even know if such a
> > thing is possible.
> >
> > "Stephany Young" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Put a concole.writeline in an eventhandler for every event for the

> object
> > in
> > > question.
> > >
> > > "Erik Frey" <(E-Mail Removed)> wrote in message
> > > news:OxI$(E-Mail Removed)...
> > > > Hi there,
> > > >
> > > > Just curious as to whether there's a clever way to see the

events
> a
> > > > control/object is firing off, perhaps written out to the debug

> console.
> > > It
> > > > would be really handy to know which events a control is firing when

I
> > > > perform a certain action, and the order in which they are occurring.
> > > >
> > > > Thanks,
> > > >
> > > > Erik
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Jay B. Harlow [MVP - Outlook]
Guest
Posts: n/a
 
      6th Sep 2003
Erik,
Thanks for the link! I'll need to look at that later.

Jay

"Erik Frey" <(E-Mail Removed)> wrote in message
news:eCXX0u%(E-Mail Removed)...
> Thanks for the advice - it looks like you were on the right track.
> Someone pointed me to this:
>
> http://www.codeproject.com/csharp/controlinspector.asp
>
> It basically does what you describe. Pretty handy utility!
>
> Erik
>
> "Jay B. Harlow [MVP - Outlook]" <(E-Mail Removed)> wrote in

message
> news:uydTf%(E-Mail Removed)...
> > Erik,
> > To dynamically create a method (class/Assembly) look at the
> > System.Reflection.Emit namespace. Word of advice, load the dynamic

> assembly
> > into a new AppDomain so you can unload it.
> >
> > Alternatively you could use System.CodeDom to create a source module

that
> > you later compile.
> >
> > In either case you probably could have written a single module faster

and
> > manually handle all the events! However! You would not have a cool

utility
> > worth sharing, that would handle events out of any source. Of course if

> you
> > are going the cool utility route, be sure we can choose which events we

> want
> > handled! And post the utility on www.gotdotnet.com or someplace were the
> > rest of us can use it!
> >
> > BTW: Dynamically handling events I think would be handy for utilities

such
> > as www.nunit.org & www.csunit.org. Have an attribute that says this

method
> > should raise this event. The tool would dynamically handle the event to

be
> > certain it was raised. Similar to how they handles Exceptions.
> >
> > Hope this helps
> > Jay
> >
> > "Erik Frey" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > I was wondering if there was a -clever- way of doing it, dynamic

for
> > an
> > > object you choose.
> > >
> > > My initial thoughts were to use reflection to loop through all the

> > event
> > > signatures - I imagine you can do that. And adding a handler, with

some
> > > kind of dynamically created method? Maybe? I don't even know if such

a
> > > thing is possible.
> > >
> > > "Stephany Young" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Put a concole.writeline in an eventhandler for every event for the

> > object
> > > in
> > > > question.
> > > >
> > > > "Erik Frey" <(E-Mail Removed)> wrote in message
> > > > news:OxI$(E-Mail Removed)...
> > > > > Hi there,
> > > > >
> > > > > Just curious as to whether there's a clever way to see the

> events
> > a
> > > > > control/object is firing off, perhaps written out to the debug

> > console.
> > > > It
> > > > > would be really handy to know which events a control is firing

when
> I
> > > > > perform a certain action, and the order in which they are

occurring.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Erik
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to capture events for next item Ashish Microsoft Outlook Program Addins 10 5th Feb 2010 07:38 AM
PPT 2007: Capture Events Girish Microsoft Powerpoint 1 8th Jan 2010 02:26 PM
Capture FTP events =?Utf-8?B?QnJpYW4=?= Microsoft Access VBA Modules 1 16th Feb 2006 04:43 PM
How do you capture events? =?Utf-8?B?U2NvdHQgYnVja3dhbHRlcg==?= Microsoft Excel Programming 2 12th Aug 2005 05:34 PM
Re: capture all events? Martin R-L Microsoft VB .NET 0 27th Apr 2004 03:15 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:53 PM.