I want to make an application to intercept all user interface events in all forms of my application and write them to the log. This data can be used to determine which controls are most used, in which order, etc. The problem is that I want this to happen automatically, without changing existing classes.
I made a prototype that attaches a method to a click event for all controls in a form, but how can this be done for all forms? Reflection requires a target when handling events, but you can easily access only the launch form.
Is there a way to bind an object constructor? Then I could “introduce” my method into all the events of the new form. Or maybe there is another way to do this.
Thanks in advance!
Gratian lup
source share