What is the windows message sent to the application when terminated abruptly ?

Posted on 2008-01-31
Medium Priority
Last Modified: 2013-11-20
My application is making some RPC connections to Windows services. When the application is closed by exit button( X mark on the right corner of the Application Window)y. All the connections are ended properly. And the next time you can launch the application successfully.

In case if application is terminated abruptly ( if i kill the application in the task manager or if i log off when the application is still running), the RPC connections are not ended properly. When i launch the application again i get error as RPC connection still in use.

So what is the Windows messgae where i can close all the connections when applications is terminated abruptly ? Please not that WM_DESTROY message is not getting called when i kill the application

Question by:madhav_119
  • 3
  • 2
LVL 19

Expert Comment

ID: 20787212
When user log off, a WM_QUERYENDSESSION is sent to the application main window (ON_WM_QUERYENDSESSION macro in MFC).

Author Comment

ID: 20787380
Thanks for the quick reply..
What about when program is terminated abruptly?

LVL 45

Expert Comment

ID: 20787491
As far as I know terminating a running application does NOT send it any messages to signal it to finish nicely.  It kills it - brutally.
2018 Annual Membership Survey

Here at Experts Exchange, we strive to give members the best experience. Help us improve the site by taking this survey today! (Bonus: Be entered to win a great tech prize for participating!)

LVL 19

Accepted Solution

alb66 earned 375 total points
ID: 20787534
Sorry, I don't know. As Andy said, I think no message are sent to application.
Another idea could be to monitor your application from another one:


Author Comment

ID: 20789151
My other application is Win32 service. Right now as work around, i have to restart a service to end all the rpc connections. Can you give me some hints on how this can be done from Win32 service. how do i monitor in Win32 service that one of the application connected to it is killed.
 thanks a lot..

Author Comment

ID: 20812103
Thank you all..

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
If you use Adobe Reader X it is possible you can't open OLE PDF documents in the standard. The reason is the 'save box mode' in adobe reader X. Many people think the protected Mode of adobe reader x is only to stop the write access. But this fe…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video I will demonstrate how to set up Nine, which I now consider the best alternative email app to Touchdown.
Suggested Courses
Course of the Month3 days, 15 hours left to enroll

601 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