Welcome! Log In Create A New Profile

Advanced

How to detect reason for App shutdown?

Posted by Yogi Yang.pcs.crosspost 
Yogi Yang.pcs.crosspost
How to detect reason for App shutdown?
October 10, 2012 08:37AM
Hello,

I will try to explain in greater detail.

I want to write an app that will not close when user clicks on the app's close button on far top right of window but instead it should minimize to system tray.

Again when windows is shutting down I should be able to detect this situation and close my app safely.

How can I accomplish this?

TIA

Yogi Yang

Message forwarded from pcsoft.us.windev
Arie
Re: How to detect reason for App shutdown?
October 10, 2012 10:08AM
Hi,
the OS sends a message. From the top of my head: WM_QUERYENDSESSION
Catch this event and do whatever you want.
Pragma Tix
Re: How to detect reason for App shutdown?
October 10, 2012 10:16AM
Windows shutdown :
EXTERN "WinConst.WL"
id1 is system int = Event( "WinShutDown","*.", WM_ENDSESSION" )
id2 is system int = Event( "WinShutDown","*.", WM_QUERYENDSESSION )

PROCEDURE WinShutDown(msg, wParam,lParam)
// handle message
END
See : MSDN - read user comments
[msdn.microsoft.com]

and WD online help
[doc.pcsoft.fr]
HTH
#pragma



Edited 1 time(s). Last edit at 10/10/2012 10:21AM by Pragma Tix.
Pragma Tix
Re: How to detect reason for App shutdown?
October 10, 2012 10:30AM
Reminder, before answere, wait a few minutes, maybe Arie is answering just now smiling smiley
#pragma
Yogi Yang
Re: How to detect reason for App shutdown?
October 11, 2012 03:40PM
Thanks everyone for suggestions.

I can always do what you people have suggested but what I am looking for is a way to do this easily and it should be supported by WD's framework itself.

For example in case of VB6 we can check the mode of unloading to determine the reason for window closing in QueryUnload event.

Thanks,
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: