C++Builder3: Terminating app in TForm1
Posted on 1998-09-17
This is my problem: In the TForm1 constructor (or in the
TForm1::OnCreate handler) I run a dialog box to see if the user
wants to continue (installation or something). If he doesn't, I
want to quit the application. I use this code:
if (Application->MessageBox("Do you want to continue?",
"Question", MB_OKCANCEL)!=idOk) //or something
This works, BUT! The TForm1 IS drawn in a flash and then killed.
I want the program to exit cleanly, not with a lot of flashing windows
after I already clicked 'cancel'.
There are 2 options i've tried. Either I put the question in the
main program file (the one that contains Application->FormCreate(....)
and Application->Run()), but this stinks since I have 2 places I want to
be able to quit and I do a lot of initializing.
The other option is to change the Application->Terminate() to:
This SEEMS to work just fine, the window does not get drawn, BUT!
the IDE still thinks the program is running, and if you press
ctrl-alt-del, the project is still running! I assume that there is
one thread still running because i did not return from the event handler
until the program had terminated.
Can anyone help me with this please?
Thanks a lot!
Kenney aka Forge.