Here're some info via Peter Below's previous postings (Team B, compliled by
Micahel Cessna),

"watch for WM_QUERYENDSESSION (not WM_CLOSE, you don't get
this message on system closedown)."

"the main forms OnCloseQuery event should fire when the app receives the
WM_QUERYENDSESSION message. OnClose and OnDestroy will not fire, however.
.."

If using:  "Application.Terminate, it bypasses OnCloseQuery! "


"handle WM_ENDSESSION and call Halt when you see it. It is brutal but all is
lost anywhay at this point <g>. You can also handle WM_QUERYENDSESSION and
close down normally when you see it."


"WM_QUERYENDSESSION and WM_ENDSESSION are send to all top-level windows.
If you need to do some processing do it in response to WM_QUERYENDSESSION.
This message will fire the main forms OnCloseQuery event, by the way.
When WM_ENDSESSION comes along the system is already on its way to the great
beyond and your app will have very little time left to do its stuff.
.."


"With very few
exceptions each message has a definite receiver (a window) and only that
receiver gets the message. It may forward it to others, but that is not
automatic. The WM_CLOSE and WM_QUERYENDSESSION messages go to the form (a
top-level window) and are not forwarded to the components on the form.

"So if you want to get at them on the component level you need to
"subclass" the form. Which means: you attach a method of your component to
the forms WindowProc property, saving the old value of the property first.
You method now gets all meessages the form gets, you must pass them to the
WindowProc you replaced but have a change to react to them yourself before
or after you handed the message to the replaced method.

"You usually do the subclassing in the controls constructor (assuming that
the passed owner is the form you want to subclass) or in a
overridden Setparent method (only an option if your component derives from
TControl), where you can use GetParentForm to get at the form. The
subclassing should be reversed in the components destructor, but *only* if
the forms WindowProc property still contains your method! If it does not
some other component has also subclassed the form and that is a touchy
situation.

----- Original Message ----- 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, 24 June 2004 10:44 a.m.
Subject: [DUG] RE: DUG Shutdown


>
> Hi Rohit,
>
> Isn't there a WM_QueryEndSession?  I'm not sure when that fires, but it
should be before WM_CLOSE.
>
> Regards,
>
> Bevan
>
>
> -------Original Message---------
>
> From:"Rohit Gupta" <[EMAIL PROTECTED]>
> To:NZ Borland Developers Group - Delphi List <[EMAIL PROTECTED]>
> Cc:
> Subject:RE: [DUG] Shutdown
> Date:Thu, 24 Jun 2004 10:29:10 +1200
>
> Found it WM_Endsession.  The only problem is that it fires after
> WM_CLOSE.  Whereas I want to know at close time why the app is
> being closed.
>


----------------------------------------------------------------------------
----


> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi
>

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to