Subj : want to execute code as soon as application is run To : borland.public.cpp.borlandcpp From : Simon Hearn Date : Tue Jul 19 2005 12:00 pm 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 .