Unfortunately I had already tried this and it doesn't work either.
The closet I've been able to get is by checking for a value of 1 and then
sending Application.Terminate in the WMQueryEndSession procedure.  What
happens then is all my tray icons disappear and my application kind of
half-closes...but not all the way, and the Windows Close is suspended.  
        Is there anyway to trap the system menu CloseButton on a form?  If I
could just do that, or check to see if it is the sender of the close
command, I could handle the entire problem differently.  

from Robert Meek dba Tangentals Design  CCopyright 2006

"When I examine myself and my methods of thought, I come to the conclusion
that the gift of Fantasy has meant more to me then my talent for absorbing
positive knowledge!"
                                                    Albert Einstein


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of David J Taylor
Sent: Monday, March 20, 2006 9:40 AM
To: Borland's Delphi Discussion List
Subject: Re: 2 quick questions BDS 2006

Robert Meek wrote:
> 1. I have an application which although it's mainform shows a
> close button, I have a Boolean var being read in the OnCloseQuery
> procedure disallowing close unless set to TRUE via the application's
> main menu Exit command.  This works fine, however I also want the app
> to close normally if running when Windows itself is shut down.  Is
> there anyway to do this? 

Robert,

You could handle the WMQueryEndSession message, e.g.


procedure TFormMain.WMQueryEndSession (var Msg: TWMQueryEndSession);
begin
  StopProgram;    // do whatever to allow Close
  Msg.Result := 1;
end;

David
_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list -> [email protected]
http://www.elists.org/mailman/listinfo/delphi

Reply via email to