Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you intercept Windows VM_DESTROY message?

Status
Not open for further replies.

zakman

Programmer
Aug 15, 2001
49
0
0
US
Hello everyone,

I have received a request to try to intercept the VM_DESTROY message that is issued by the Task Manager when you end a process. Well, as you might have guessed, the process happens to be my application. I merely want to record in a log that my app was terminated and then gracefully exit.

We have some users that would rather go to the trouble of opening Task Manager, finding the process, and terminating it... rather than just entering a 5 digit# and closing it normally. Go figure...

If you have any sample code that I can implement fairly easily, I would greatly appreciate it.

Take care,
Kevin
 

Have you tried the query unload event of the form? Give it a once over. It should be able to catch the end task (if I remember correctly) but it will not catch the terminate process. To catch that I believe you will have to hook the window (search "hook" or "hooking window") and intercept the message.

BTW have you read FAQ222-2244?

Good Luck

 
Receiving an "end process" message from windows is about like issuing the END command within VB. Everything comes to a screeching halt & no events are fired.

I believe that I will have to learn how to hook a window, or perhaps subclassing it (I read that somewhere).

As for the FAQ222-2244, I wasn't able to view that.

Thanks for your input though... any other ideas? :)

--Kevin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top