Error Using FormDestroy method in Borland C++ 6.0

D

deepakmitbhu

Hi,

I'm developing a database application using Borland C++ 6.0.
In one of the form the application throws an error when exiting
because of the following peace of code.when code inside the function
is removed it works perfectly.
void __fastcall Tf_ftp::FormDestroy(TObject *Sender)
{
AddToLog(Memo1->Lines);
}

The FormDestroy method is called when MainForm tries to destroy a
module in the application.
The troublesome code works perfectly elsewhere.

Please throw some light on FormDestroy function and it's handling.

Regards,

Deepak
 
T

Thomas Matthews

Hi,

I'm developing a database application using Borland C++ 6.0.
In one of the form the application throws an error when exiting
because of the following peace of code.when code inside the function
is removed it works perfectly.
void __fastcall Tf_ftp::FormDestroy(TObject *Sender)
{
AddToLog(Memo1->Lines);
}

The FormDestroy method is called when MainForm tries to destroy a
module in the application.
The troublesome code works perfectly elsewhere.

Please throw some light on FormDestroy function and it's handling.

Regards,

Deepak

You will have to ask in a Borland newsgroup, as this newsgroup
is only concerned with _standard_ C++ which has no knowledge
of the FormDestroy function.

How scary, the operating system can destroy modules in an
application!

--
Thomas Matthews

C++ newsgroup welcome message:
http://www.slack.net/~shiva/welcome.txt
C++ Faq: http://www.parashift.com/c++-faq-lite
C Faq: http://www.eskimo.com/~scs/c-faq/top.html
alt.comp.lang.learn.c-c++ faq:
http://www.raos.demon.uk/acllc-c++/faq.html
Other sites:
http://www.josuttis.com -- C++ STL Library book
 
B

Bob Hairgrove

Hi,

I'm developing a database application using Borland C++ 6.0.
In one of the form the application throws an error when exiting
because of the following peace of code.when code inside the function
is removed it works perfectly.
void __fastcall Tf_ftp::FormDestroy(TObject *Sender)
{
AddToLog(Memo1->Lines);
}

The FormDestroy method is called when MainForm tries to destroy a
module in the application.
The troublesome code works perfectly elsewhere.

Please throw some light on FormDestroy function and it's handling.

Regards,

Deepak

This is a VCL-related problem of order of construction/destruction.
The quick answer is: do not use FormDestroy for anything that needs
access to any members of your class, especially other VCL objects.
They have already gone by the time FormDestroy() is called. Use
OnClose() or the destructor of your form's class.

VCL doesn't follow the rules of C++.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,173
Messages
2,570,938
Members
47,473
Latest member
pioneertraining

Latest Threads

Top