I'm using the following code to create a bitmap of the app, but on closing the app I get a memory leak report indicating that the problem is with the
imgWindow := TBitmap.Create; I've tried to change
imgWindow.Free; to
imgWindow.Destroy; but still get the memory leak.
Any help would be gratefully received.
procedure TForm1.Button2Click(Sender: TObject);
var
imgWindow: TBitmap;
begin
imgWindow := TBitmap.Create;
try
imgWindow := Form1.GetFormImage;
imgWindow.SaveToFile('c:\FormImage.bmp');
finally
imgWindow.Free;
end;
end;