?
Solved

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

Posted on 2008-01-31
6
Medium Priority
?
188 Views
Last Modified: 2013-11-20
Hi,
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

Thanks
0
Comment
Question by:madhav_119
  • 3
  • 2
6 Comments
 
LVL 19

Expert Comment

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

Author Comment

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



0
 
LVL 45

Expert Comment

by:AndyAinscow
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.
0
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

by:
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:

http://www.experts-exchange.com/Programming/System/Windows__Programming/MFC/Q_20756050.html
0
 

Author Comment

by:madhav_119
ID: 20789151
Hi,
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..
0
 

Author Comment

by:madhav_119
ID: 20812103
Thank you all..
0

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