how to detect app killing
-
Does anybody know how to detect that an app is being killing?? some games, like command & conquers show you a dialog to close when you try to kill from process list. is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing??? modif: am using VB6 -------------------------- there's another hope... -- modified at 15:28 Wednesday 11th January, 2006
-
Does anybody know how to detect that an app is being killing?? some games, like command & conquers show you a dialog to close when you try to kill from process list. is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing??? modif: am using VB6 -------------------------- there's another hope... -- modified at 15:28 Wednesday 11th January, 2006
If you're talking about a VB.NET WinForm app, then you need to handle the form's "Closing" event. If this is a VB6 app, then you need to catch the "Form_QueryUnload" event. -- modified at 14:12 Wednesday 11th January, 2006
-
Does anybody know how to detect that an app is being killing?? some games, like command & conquers show you a dialog to close when you try to kill from process list. is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing??? modif: am using VB6 -------------------------- there's another hope... -- modified at 15:28 Wednesday 11th January, 2006
edwin164 wrote:
is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???
AFAIK that's the only WM message. In the beginning the OS tries to close it in a polite way sending that message. Still you don't need to intercept the message since the framework provides you with a pre-built event for each form (Closing). That event allows you to cancel the closing with the Cancel argument. If the form is mandatory closed by an external event (OS) again the FW should give you the event Closed.
-
edwin164 wrote:
is there a windows message (other than WM_CLOSE) that can tell me that my app is being killing???
AFAIK that's the only WM message. In the beginning the OS tries to close it in a polite way sending that message. Still you don't need to intercept the message since the framework provides you with a pre-built event for each form (Closing). That event allows you to cancel the closing with the Cancel argument. If the form is mandatory closed by an external event (OS) again the FW should give you the event Closed.
-
If you're talking about a VB.NET WinForm app, then you need to handle the form's "Closing" event. If this is a VB6 app, then you need to catch the "Form_QueryUnload" event. -- modified at 14:12 Wednesday 11th January, 2006
-
am using VB6 so no framework is available... :( i wondering how some apps (probably not written in VB) can intercept a process killing. not using forms event is there another way to execute code before process die??
No, there is no way to trap this without the "event". You're application get's sent a WM_CLOSE message. This shows up in your app as the form Closing event. Handle this event. You DON'T have to return a response immediately, Windows will wait for around for a response. When this event happens, you can put up your dialog. In response to the dialog, you can then respond to the Closing event by setting the Cancel property appropariately. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
am using VB6, but without form events, is there a way to detect a process killing, to show a dialog or execute code?? i see this in some games, i wonder how the program do not terminate but show a dialog asking you to confirm program exit.
edwin164 wrote:
i see this in some games, i wonder how the program do not terminate but show a dialog asking you to confirm program exit.
I would expect a game to make calls to PeekMessage() within the game loop. It would need to do this to receive keyboard and mouse input. It would also catch the window's WM_CLOSE and maybe the WM_QUIT events as well, allowing the game to close itself gracefully. You need the window's handle in order to receive its messages. Once you receive the WM_CLOSE message, you can display your confirmation dialog. You would call DestroyWindow(hWnd) to close it afterwards, if you're doing it via Win32 API.
-
am using VB6 so no framework is available... :( i wondering how some apps (probably not written in VB) can intercept a process killing. not using forms event is there another way to execute code before process die??