Hello Leigh, The below works to a point. If only the mainform is shown, it closes when shutdown is activated, but any ensuing programs remain, OR the rest of the shutdown procedure is interrupted until the shutdown button is pressed again.
Also, If I have the modal form active (dmon.Form1), then it raises an error. I tried the following in mainform.closequery dmon.Form1.Destroy; //the modal form. but still error. Thanks, Alistair+ Wednesday, March 5, 2003, 9:02:24 AM, you wrote: LW> Hi Alistair, LW> I thought that you need to override two message WM_ENDSESSION and LW> WM_QUERYENDSESSION in your main form. LW> Here is a sample. LW> procedure WMEndSession(var Message: TMessage); message WM_ENDSESSION; LW> procedure WMQueryEndSession(var Message: TMessage); message LW> WM_QUERYENDSESSION; LW> procedure TFormMain.WMEndSession(var Message: TMessage); LW> begin LW> Close; LW> end; LW> procedure TFormMain.WMQueryEndSession(var Message: TMessage); LW> begin LW> Message.Result := 1; LW> end; LW> Cheers LW> Leigh LW> -----Original Message----- LW> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] LW> Behalf Of Alistair George LW> Sent: Tuesday, March 04, 2003 5:22 PM LW> To: Multiple recipients of list delphi LW> Subject: [DUG]: Shutdown windows closure LW> Hi all. LW> More problems (D5). LW> When shutting down, the program refuses to close. Other programs close, but LW> this LW> one stays open, not allowing system stop. It does not go to formclose, LW> or query events. However, if I use closebox it behaves normally. LW> Ideas? LW> Thanks, LW> Al+ LW> --------------------------------------------------------------------------- LW> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] LW> Website: http://www.delphi.org.nz LW> To UnSub, send email to: [EMAIL PROTECTED] LW> with body of "unsubscribe delphi" LW> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ LW> --------------------------------------------------------------------------- LW> New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] LW> Website: http://www.delphi.org.nz LW> To UnSub, send email to: [EMAIL PROTECTED] LW> with body of "unsubscribe delphi" LW> Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/ -- Regards, Alistair+ --------------------------------------------------------------------------- New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED] Website: http://www.delphi.org.nz To UnSub, send email to: [EMAIL PROTECTED] with body of "unsubscribe delphi" Web Archive at: http://www.mail-archive.com/delphi%40delphi.org.nz/