Re: Program closure



Tim Cogher wrote:
I am trying to force any users of my program to close it using the Exit menu item and not simply stop the program using the top right red cross icon ( in Win XP).

That's an uphill battle. What's wrong with your program that it can't handle being closed the way other programs get closed?


You don't have special clean-up code in your exit menu item's OnClick handler, do you? Move that code to your main form's OnClose or OnCloseQuery event. Those events gets called no matter how the form tries to close. Your exit menu shouldn't have to do anything more than call Close.

--
Rob
.



Relevant Pages

  • Re: Stoping a program from exiting
    ... You should put all that code in your form's OnCloseQuery event handler. ... (I can't remember the last time I chose "exit" from a menu; ... The save-as dialog box has a Cancel message of its own. ...
    (alt.comp.lang.borland-delphi)
  • Re: Check the contents of a dialog before closing
    ... >> I also exit the function besides setting OKBtn.ModalResult, ... OnCloseQuery event and it works fine. ... Alan. ... Prev by Date: ...
    (borland.public.delphi.non-technical)