Yes, you're right... 

i usually use release when i open form using 'ShowModal', right after the close 
command to release all object variable. But if you open a form using 'Show' 
command it will be better if u use caFree in the Close events. But if you want 
to write your own code to release all the variables and object, using 
PostMessage or SendMessage, it wont be a problem.

I dont know which one is better but i think they all are the same.

----- Original Message ----- 
  From: Wilson, Stephen 
  To: [email protected] 
  Sent: Wednesday, November 19, 2008 4:31 PM
  Subject: RE: [delphi-en] Multiple instances of form


   Thanks all for your comments on and insights into this subject (looks like I 
started again that debate I said I'd seen in the past!). I think I'm getting my 
head around this now:
  if you close a form using OnClose with caFree, Release gets called (see Doug 
Hale's code quotation) which posts a CM_RELEASE message to the form allowing 
all other messages to be processed before this one (see Theo's explanation), 
and finally Delphi's message handler for CM_RELEASE, TCustomForm.CMRelease, 
calls Free, in which case it would be prudent to set the existing pointer to 
nil. If I've misunderstood, then I'm probably just too dumb ever to understand 
it - I should forget the technical and just take the empirical approach! Thanks 
again for all the input.



[Non-text portions of this message have been removed]

Reply via email to