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

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
madhav_119Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

alb66Commented:
When user log off, a WM_QUERYENDSESSION is sent to the application main window (ON_WM_QUERYENDSESSION macro in MFC).
0
madhav_119Author Commented:
Hi,
Thanks for the quick reply..
What about when program is terminated abruptly?
Thanks..



0
AndyAinscowFreelance programmer / ConsultantCommented:
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
Cloud Class® Course: Python 3 Fundamentals

This course will teach participants about installing and configuring Python, syntax, importing, statements, types, strings, booleans, files, lists, tuples, comprehensions, functions, and classes.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
madhav_119Author Commented:
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
madhav_119Author Commented:
Thank you all..
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.