By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,467 Members | 1,448 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,467 IT Pros & Developers. It's quick & easy.

Process continues to run after Application.Exit()

P: n/a
When the user clicks on my Exit menu command I call Close() followed by
Application.Exit(). The GUI goes away as expected but the process is
still listed in Task Manager. What do I need to do to really terminate
the process?

May 11 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"cweeks" <cw*********@yahoo.com> wrote:
When the user clicks on my Exit menu command I call Close() followed by
Application.Exit(). The GUI goes away as expected but the process is
still listed in Task Manager. What do I need to do to really terminate
the process?


If you have a thread somewhere that hasn't exited, the process will
still continue to run. Application.Exit posts an exit message to all
thread message pumps, causing windows to close. You should try to find
out what's running by breaking into the program with the debugger.

To force a harder exit, you can call Environment.Exit.

-- Barry
May 11 '06 #2

P: n/a
Hello cweeks,

This behavior is due to worker thread, when you close the app worker thread
continue working till finish his own task.
To prevent this, set your tread to backgroud mode (IsBackground property)
- this thead will be closed with the application

c> When the user clicks on my Exit menu command I call Close() followed
c> by Application.Exit(). The GUI goes away as expected but the process
c> is still listed in Task Manager. What do I need to do to really
c> terminate the process?
c>
---
WBR,
Michael Nemtsev :: blog: http://spaces.msn.com/laflour

"At times one remains faithful to a cause only because its opponents do not
cease to be insipid." (c) Friedrich Nietzsche
May 11 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.