Click here to Skip to main content
13,768,845 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am designing wpf application... My problem is that on window closing i want to kill the task in the task manager ... Can anyone please help me out.
Posted 5-Nov-13 18:20pm
Updated 12-Nov-17 23:16pm
Ziee-M 6-Nov-13 1:42am
When closing your form, the application should handle closing process in the task Manager, if it dosent, then you have some ressources used that blocks the application from terminating.
You should dispose all disposable ressources and terminates your application threads in the form closing event!
jing567 6-Nov-13 1:44am
how to dispose all that threads yar... I am new to this please provide me if you have any sample snippet
Ziee-M 6-Nov-13 2:01am
Share your code or some of it, otherwise no one can help you!
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Have you tried using process.Kill() to kill process in task manager

using System.Diagnostics;
 foreach (Process proc in Process.GetProcessesByName("OUTLOOK"))

Hope it helps you.
jing567 6-Nov-13 4:59am
Hello Keerth,
Can you help me that how to get the exact name of my application ... Dont laugh at my question.. I am placing my app name but i am unable to get the process
keerth516 6-Nov-13 6:23am
ha ha ha...okay normally WPF app running in task manager will appear as appName.vshot.exe

and am not sure what is your purpose of doing it.
jing567 6-Nov-13 7:13am
Hi Keerth,
My requirement is that whenever I close my window application , the service that is associated to that application should be killed... thats what my requirement....
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

Just Place ane event in the xaml code


Then write a event handler for that closing event in .cs page


private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Cookies | Terms of Service
Web04-2016 | 2.8.181116.1 | Last Updated 13 Nov 2017
Copyright © CodeProject, 1999-2018
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100