Solved

Intercept the signal for TerminateProcess

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

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

In this article, I will show how to use the Ribbon IDs Tool Window to assign the built-in Office icons to a ribbon button.  This tool will help us to find the OfficeImageId that corresponds to our desired built-in Office icon. The tool is part of…
This article describes a technique for converting RTF (Rich Text Format) data to HTML and provides C++ source that does it all in just a few lines of code. Although RTF is coming to be considered a "legacy" format, it is still in common use... po…
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

746 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

11 Experts available now in Live!

Get 1:1 Help Now