In FormClose...

var
  gif: TGIFImage;

begin
  gif := TGIFImage(Logo.Picture.Graphic);
  Logo.Picture.Graphic := Nil;
  gif.Free;

----- Original Message -----
From: "Ross Levis" <[EMAIL PROTECTED]>
To: "Alistair George" <[EMAIL PROTECTED]>; "NZ Borland Developers Group-
Delphi List" <[EMAIL PROTECTED]>
Sent: Monday, May 31, 2004 8:11 PM
Subject: Re: [DUG] TGIFImage


> TGIFImage.Create doesn't want any parameters.
>
> It turns out it doesn't get freed.  I put breakpoints in the create and
> destroy procedures of TGIFImage and counted one more Create than Destroy.
> And this didn't work in the FormClose:
>
> TGIFImage(Logo.Picture.Graphic).Free;
>
> It causes an access violation which I can't fathom.  I was trying to use
> less RAM but it seems I need to do this afterall.
>
> var
>   GIF: TGIFImage;
> begin
>   GIF := TGIFImage.Create;
>   GIF.LoadFromResourceName(hInstance, 'Logo', 'GIF');
>   Logo.Picture.Graphic := GIF;
>   GIF.Free;
> end;
>
> Cheers,
> Ross.
>
> ----- Original Message -----
> From: "Alistair George" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Monday, May 31, 2004 6:53 PM
> Subject: Re: [DUG] TGIFImage
>
>
> > Hi Ross,
> > I'll take a punt and say:
> > If it were created local, it would be freed, if were a global then
> freeandnil(Logo) on
> > formclose;
> > But since you have Logo on the form, the form being closed should free
the
> > component (and image). However, should it not be TGIFImage.Create(self).
> > Others will correct me if Im wrong!
> > Cheers,
> > Al+
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
>
_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to