Board index » delphi » action:= cafree ->crash

action:= cafree ->crash

Hi!

In almost all my forms I use action:= cafree in the OnClose Event.

On some computers my program does crash because of this command. I
know
this because I've removed it once and then it worked fine everywhere.

What does this happen?

Marby it's important: I'm using this

procedure TForm.CreateParams(var Params: TCreateParams);
begin
? ? ?inherited CreateParams(Params);
? ? ?Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
? ? ?Params.WndParent := GetDesktopWindow;

end;

to display the form with an own taskbar entry.

Best regards

Hansjoerg

------------------------------------------------------------------------
DOWNLOAD MY E-MAIL CLIENT from http://members.magnet.at/tb_posch/dm
------------------------------------------------------------------------

 

Re:action:= cafree ->crash


Quote
Hansjoerg Posch wrote:

> Hi!

> In almost all my forms I use action:= cafree in the OnClose Event.

> On some computers my program does crash because of this command. I
> know
> this because I've removed it once and then it worked fine everywhere.

snip

> Best regards

> Hansjoerg

Sounds like you are still accessing the form in some other forms
events. Try setting the form to Nil in the OnDestroy and see if you
get any further.

HTH

Ray Cramer
R...@Pol.ac.uk

Re:action:= cafree ->crash


Hansjoerg Posch <tb_po...@magnet.at> wrote in article
<34e774d5.49194...@news.magnet.at>...

Quote
> Hi!

> In almost all my forms I use action:= cafree in the OnClose Event.

> On some computers my program does crash because of this command. I
> know
> this because I've removed it once and then it worked fine everywhere.

> What does this happen?

> Marby it's important: I'm using this

> procedure TForm.CreateParams(var Params: TCreateParams);
> begin
> ? ? ?inherited CreateParams(Params);
> ? ? ?Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
> ? ? ?Params.WndParent := GetDesktopWindow;

> end;

> to display the form with an own taskbar entry.

> Best regards

> Hansjoerg

> ------------------------------------------------------------------------
> DOWNLOAD MY E-MAIL CLIENT from http://members.magnet.at/tb_posch/dm
> ------------------------------------------------------------------------

You shouldn't use cafree in the code of the form thats being freed (the
form is still processing when the cafree message is sent).  Just use cahide
instead.  Are you just trying to recover memory?
--

=========================================
bgrav...@vha.NOSPAM.com
codi...@airmail.NOSPAM.net
=========================================

Other Threads