iqbal_delphidev wrote: > Just write down the following... > . > . > try > yourComplexFunction(); //that takes long time to process... > ...... > ...... > Application.ProcessMessages; > finally > .... > end; > > in the above case you need not to make loops. and it will also > optimize your code to speed.
That doesn't solve anything. While the complex function is running, the program is not responding messages, and the OS will (correctly) report that fact and offer to close the program. If you don't want the OS to think your program has stopped responding, you need to make sure your program responds. What's that try-finally block for? If you can't break your operation into smaller pieces between which you can pause to process the messages that have arrived in your program in the meantime, then you need to consider moving your long operation into a separate thread. The OS won't send messages to that other thread because it won't have any windows that the OS cares about. Your original main thread will be free to continue responding to the user. -- Rob

