Solved

Intercept the signal for TerminateProcess

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

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 Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
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…

920 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

16 Experts available now in Live!

Get 1:1 Help Now