Board index » delphi » Please help with D5 OnClose event.

Please help with D5 OnClose event.

Hi all,

I am running Winblows 2000 Prof with Delphi 5.01
Basically i want some lines of code executed whenever the exe's process is
Closed normally or killed by the W2000 shutdown.
I tried OnClose and OnDestroy but those events are not fired when shutting
down 2000.
Can someone help me please ?
Big thanks in advance.

victor

 

Re:Please help with D5 OnClose event.


"balbaro" <balb...@skynet.be> skrev i en meddelelse
news:8ii67e$n7o$1@news1.skynet.be...

Quote
> I am running Winblows 2000 Prof with Delphi 5.01
> Basically i want some lines of code executed whenever the exe's process is
> Closed normally or killed by the W2000 shutdown.
> I tried OnClose and OnDestroy but those events are not fired when shutting
> down 2000.
> Can someone help me please ?

Normally when an application closes it receives a WM_CLOSE and WM_DESTROY
message. It is these messages that fires the OnClose and OnDestroy events.
But when Windows is shutting down it doesn't bother with sending these
messages.
Instead the application will receive a WM_QUERYENDSESSION message and a
WM_ENDSESSION message when the system goes into shutdown mode. The VCL uses
this message to fire OnCloseQuery, as it does for WM_CLOSE (a normal close).
You can add a handler for one of these messages to your main form.
Or just use the OnCloseQuery event.

Finn Tolderlund

Re:Please help with D5 OnClose event.


Hi Finn

Thx for the help.

victor

Finn Tolderlund <XnospamYfinn.tolderlu...@Ymobilixnet.dkXnospamY> wrote in
message news:Hs135.1092$k3.235739@news0.mobilixnet.dk...

Quote

> "balbaro" <balb...@skynet.be> skrev i en meddelelse
> news:8ii67e$n7o$1@news1.skynet.be...
> > I am running Winblows 2000 Prof with Delphi 5.01
> > Basically i want some lines of code executed whenever the exe's process
is
> > Closed normally or killed by the W2000 shutdown.
> > I tried OnClose and OnDestroy but those events are not fired when
shutting
> > down 2000.
> > Can someone help me please ?

> Normally when an application closes it receives a WM_CLOSE and WM_DESTROY
> message. It is these messages that fires the OnClose and OnDestroy events.
> But when Windows is shutting down it doesn't bother with sending these
> messages.
> Instead the application will receive a WM_QUERYENDSESSION message and a
> WM_ENDSESSION message when the system goes into shutdown mode. The VCL
uses
> this message to fire OnCloseQuery, as it does for WM_CLOSE (a normal
close).
> You can add a handler for one of these messages to your main form.
> Or just use the OnCloseQuery event.

> Finn Tolderlund

Other Threads