Process continues to run after Application.Exit()

  • Thread starter Thread starter cweeks
  • Start date Start date
C

cweeks

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?
 
cweeks said:
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top