Tag Archives: DestroyWnd

Preserve Internal State (/Window Handle) when Changing Parent or Style for an ActiveX Control – aka How To RecreateWnd “Properly” for TOleContainer ancestors

In any (VCL) Delphi application more stuff happens behind the scenes than you might be aware of.
As known, every (TWinControl descendant) control placed on a form (like TButton or TEdit) and even the (T)Form itself is actually a wrapper for a Windows screen object. Every such object is “defined” by something called Window Handle. You can use the Handle value to do stuff with the underlying Windows screen object like hide or show it or move around its parent (another Windows screen object) or change some of its properties.
Continue reading