Re: OnDestroy never called in TActiveForm



In article <1125666868.872116.88930@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
Sonnich <sonnich.jensen@xxxxxxxxxxxxxx> wrote:
> Hi!
>
> I have and active x from (TActiveForm), which includes different
> things....
> The point it, that there is an OnCreate event, which works...
>
> however, the OnDestroy is never called....
>
> have anyone worked with this?
>
> I get some funny action, when the programme is being closed, as I
> cannot close all my stuff (e.g. a thread).
>
> Any ideas anyone?

Yes, first look at the end of the interfaces section for the following
declaration in the class of your main form (by default TActiveFormX):

procedure Initialize; override;

and just after it, add:

procedure BeforeDestruction; override;

Then in the implementation section, add the follwing procedure:

procedure TActiveFormX.BeforeDestruction;
begin
OnDestroy := ActiveFormDestroy;
inherited;
end;

Where TActiveFormX is the class type of your main form.

See http://groups.google.co.uk/group/borland.public.delphi.com.activex.writing/browse_frm/thread/19e6d7310deadd18/83a386efcd8653e0 for my original posting on this topic.

Cheers
Tony
--
Tony Mountifield
Work: tony@xxxxxxxxxxxxx - http://www.softins.co.uk
Play: tony@xxxxxxxxxxxxxxx - http://tony.mountifield.org
.