Solved

Intercept the signal for TerminateProcess

Posted on 1997-05-08
3
586 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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

If you have ever found yourself doing a repetitive action with the mouse and keyboard, and if you have even a little programming experience, there is a good chance that you can use a text editor to whip together a sort of macro to automate the proce…
zlib is a free compression library (a DLL) on which the popular gzip utility is built.  In this article, we'll see how to use the zlib functions to compress and decompress data in memory; that is, without needing to use a temporary file.  We'll be c…
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…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

749 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