Board index » cppbuilder » OnDestroy (was Globals not initializing)

OnDestroy (was Globals not initializing)


2003-07-08 07:46:22 PM
cppbuilder21
Quote
Hmm, up until now I had no idea. But seeing "CreateForm" even
*mentioned* in your code immediately brings to light a potential
suspect of the problem.

Please review this article, which MAY shed some light on the problem
(if my guess is correct at least.)

www.bcbdev.com/articles/suggest.htm

To summarize, you shouldn't ever use CreateForm (the OnCreate event)
for anything, ever. It can cause bizarre crashes. Maybe this is your
problem, but it's really hard to say for sure.
OK that answers a little niggle I had been having, but which
was not causing any real trouble. So I thought I would have
a look at clearing it up.
I'm using an interface to Winamp, and the 'sample' showed
using OnCreate and OnDestroy to load and unload it. Moving
the OnCreate stuff is fine, but where should I move the
OnDestroy stuff to.
Builder5 complains if I try to add a ~xxx destructor - I've
always used OnDestroy in the past :)
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services
 
 

Re:OnDestroy (was Globals not initializing)

Quote
It should be in the destructor. And yes, you can add a destructor, I have
them everywhere - even in BCB5.
Pete
It's amazing how prevalant OnCreate and OnDestroy are in the
builder books I have, but I eventually found the bit I needed.
Leo
I had the __fastcall, but the .cpp and the .h entries were
not quite the same. It was the error that said "~xxx already
exists" that through me - and no error for the wrong header
entry.
All working now - so we will see if the once a week or so
niggle goes away ;)
--
Lester Caine
-----------------------------
L.S.Caine Electronic Services