Board index » cppbuilder » Application->Terminate() <-- in constructor...
George
![]() CBuilder Developer |
George
![]() CBuilder Developer |
Application->Terminate() <-- in constructor...2004-10-27 09:31:39 PM cppbuilder14 Hi All, I'd like to terminate application in constructor if some condition is true. and I do if(condition) Application->Terminate(); well it sort of terminates, at least doesn't go any further, but the process stays forever. well I don't know forever or not, coz have never tried, but for a long time anyway... |
Tom|420
![]() CBuilder Developer |
2004-10-28 04:26:36 AM
Re:Application->Terminate() <-- in constructor...
George wrote:
QuoteHi All, I'd like to terminate application in constructor if some condition or as a quick temporary solution. What it does for me is that I see the form appear on screen for a split second than disappear as the application terminates. For a more elegant solution you should try to cancel away program startup directly from the WinMain fonction (Project1.cpp if you don't change the projet name, or <your project name>.cpp). Simply, check you condition form the very beginning of the function, before the BCB forms creation stuff, and if you condition is not satisfactory than simple return. The application terminates as soon as the WinMain function returns (the Application->Run() function in WinMain does not return until the main form was closed). Since no form is created, the user gets no clue that the program ever started. This is good, for example, if you want to prevent two instances of your program from running at once. |
George
![]() CBuilder Developer |
2004-10-28 09:13:04 PM
Re:Application->Terminate() <-- in constructor...
Hi Tom, thanks for answering,
the problem is that I can't check it in project's .cpp file... because I'm checking something that is done in form's constructor.... and well if it's not done correctly I just need to quick. "Tom|420" < XXXX@XXXXX.COM >wrote in message QuoteGeorge wrote: {smallsort} |