Link to home
Start Free TrialLog in
Avatar of bnz
bnz

asked on

Free and OnClose caFree

Hi

If I in a OnClose event for a form have set Action to caFree and then call Free for the form. Should this result in a memory access error or is this another fault in my program?
ASKER CERTIFIED SOLUTION
Avatar of Stefaan
Stefaan

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Lukasz Zielinski
if OnClose handler sets action to caFree simply call Form.Close
ziolko.
Avatar of Stefaan
Stefaan

That would depend on the the way he is showing it, if he is showing it Modally ( using .ShowModal ), the Close would be rather obsolete.

As I said before, simply use .Release instead of free.  The release will send a CM_RELEASE message, the form will process all messages until it reaches the CM_RELEASE and when it reaches that one it will destroy itself.  Simple as that ;-)

Regards,


Stefaan