How can I dynamically inject code into event handlers in Delphi?
问题 For debugging / performance tests I would like to dynamically add logging code to all event handlers of components of a given type at run time. For example, for all Datasets in a Datamodule, I need to run code in the BeforeOpen and AfterOpen events to capture the start time, and to log the elapsed time in AfterOpen. I would prefer to do this dynamically (no component subclassing), so that I can add this to all existing datamodules and forms with minimal effort only when needed. Iterating all