Solved

Intercept the signal for TerminateProcess

Posted on 1997-05-08
3
584 Views
Last Modified: 2013-12-04
Hi,
I have a process, and i want to call an exit procedure when the process is killed by the command "terminate process" from the task manager.
What API's of Windows NT can use to interept this signal and then call my procedure.

thanks
0
Comment
Question by:didede
  • 2
3 Comments
 

Accepted Solution

by:
incah earned 50 total points
ID: 1397197
I am calling exit procedures, in response to the WM_CLOSE message, which I get whenever the process is killed as well as
when it is closed normally.
0
 

Author Comment

by:didede
ID: 1397198
Can i have an example of code, and i think it's dont work for process working as service on windows NT.
0
 

Expert Comment

by:incah
ID: 1397199
LRESULT CALLBACK WndProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
  switch(uMsg) {
       .
       .
       .
  case WM_CLOSE:
       /********************************
       Do whatever cleanup you want here
       *********************************/
       DestroyWindow(hWnd);
       break;
  case WM_DESTROY :
       PostQuitMessage(0);
       break;
  default :
       return( DefWindowProc( hWnd, uMsg, wParam, lParam ) );
  }
  return(0L);
}
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
Entering time in Microsoft Access can be difficult. An input mask often bothers users more than helping them and won't catch all typing errors. This article shows how to create a textbox for 24-hour time input with full validation politely catching …
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now