There are ways to hook into the form streaming system, for example by overriding TComponent.ReadState
for your form to add an event handler to the TReader
handling your streaming, but they require you to actually change code in the form class in question. There doesn't appear to be any way to globally modify TReader
behavior throughout the program. So without an actual base form class for all the forms in your app, there's no easy way to do this.
Even trying to patch TComponent.ReadState
in-memory would be very difficult to do right, because it's a virtual method and there's no override for TCustomForm, so any change you made could affect all components and not just forms.
Honestly, the best way to handle this is probably just to bite the bullet and run a global search over your codebase for class(TForm
and change them all to be a subclass of some custom form class that exhibits the behavior you're looking for. There are probably theoretically other ways to accomplish it, but they would require some very hairy runtime tricks that could have unpredictable side-effects.