Subj : Re: want to execute code as soon as application is run To : borland.public.cpp.borlandcpp From : Ed Mulroy Date : Wed Jul 20 2005 10:29 am I must have misread your message. I thought you wanted to close the window or perform other actions. I did not understand that you wanted to end the program. .. Ed > Simon Hearn wrote in message > news:42de35ad$1@newsgroups.borland.com... > > In case you're interested I've solved the problem and I > thought I'd post it here (I hate it when you search for a > problem on a forum, find that someone else has had > the same thing but not bothered to put thier solution > down, really annoying!) > > All I did was to replace the "this.Destroy()" comand I > was using to close the window with > "PostQuitMessage(WM_QUIT)". Which I'm guessing > (I don't have much experience with messages etc) adds > a the quit message to the window, so when it's finished > doing whatever it is it's doing, it executes the WM_QUIT > command and closes with no fuss. > > Thanks to Jogy for the tip. .