Subj : Re: want to execute code as soon as application is run To : borland.public.cpp.borlandcpp From : Sebastian Ledesma Date : Wed Jul 20 2005 12:13 pm Hello Simon: Just another solution: int OwlMain(int , char *argv[]) { if (::MessageBox(NULL,"Want to run my App","Information", MB_YESNO)!=IDYES) return 0; //just quit ... } Saludos Sebastian "Simon Hearn" escribió en el mensaje news:42dd3fc2$1@newsgroups.borland.com... > > Hi, > > I'm trying to execute a piece of code that displays a dialog box with two buttons, on of which is cancel - exits the program. I need this code to execute as soon as the application in run and the window is displayed. > > At the moment the code is in the SetupWindow() function, which works ok. But it's actually run before the window is fully created. So when I hit cancel, the application quits, but I get an error (an exception from the TXWindow function) saying the window was not created properly (because I destroyed it before it was fully created). > > So, I either need to stop this error message appearing thus achieving a quiet exit. Or I need to place the code after the window is fully created. > > I don't know how to do either of these so can anyone help me out? > > Thanks > > Simon .