>Thank you for your input. As I wrote in my message to Dragan, the code above will work in majority of the cases. But since I will include it in a TRY/CATCH, there could be a time when the code will not run. And in this case, the application will try to close with some forms being open.
>I will test a case with a messagebox() window being open and at the same time trying to close the application.
Messagebox is nearly not solvable. As long as you don't use a custom one, you might issue KEYBOARD '{ESC}' or the like to close a messagbox. Reportpreview there is control, if you use BEHAVIOUR 90. Else there is only KEYBOARD, and the form calling the report needs to know.
I do something like setting a flag to my form telling the form that a child window is open, an then it runs through its form manager trying to close the child form first and deny it's own shut down. Job of QUERYUNLOAD. This needs a timer on application level so it try to shutdown several time. (One must first end all code where, for example, a modal window is involved, then the form.) Complex crap I lost a month till it was working.
Words are given to man to enable him to conceal his true feelings.
Charles Maurice de Talleyrand-Périgord
Weeks of programming can save you hours of planning.
OffThere is no place like [::1]