473,563 Members | 2,735 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Process continues to run after Application.Exi t()

When the user clicks on my Exit menu command I call Close() followed by
Application.Exi t(). 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
2 5897
"cweeks" <cw*********@ya hoo.com> wrote:
When the user clicks on my Exit menu command I call Close() followed by
Application.Exi t(). 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.Exi t 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.Exi t.

-- Barry
May 11 '06 #2
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.Exi t(). 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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
5938
by: Jesper Denmark | last post by:
Hi, After a given exception I would like to terminate the program. I've been told that Application.Exit() should do the trick, but I cant seem to make it work at all. It compiles fine. But it doesn't seem to do anything - the program just continues after calling the function. Should it be in a certain scope or called via the object that...
1
17665
by: Brendan Miller | last post by:
I am trying to close my application using Application.exit() in the frmMain_Closing event. When the form closes the process does not. My application only has one form (no other classes either). The form has a really long loop which generates approx. 700 .csv files. I do not create any threads myself (Application.exitthread() doesn't work...
6
20052
by: orekin | last post by:
Hi There I have been trying to come to grips with Application.Run(), Application.Exit() and the Message Pump and I would really appreciate some feedback on the following questions .. There are quite a few words in this post but the questions are actually quite similar and should be fairly quick to answer ... (1) What is Happening with...
22
2198
by: Shelby | last post by:
Hi, I used System.Windows.Forms.Application.DoEvents() in a loop to handle user click close button . Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click Me.Close() System.Windows.Forms.Application.Exit End Sub
3
1519
by: Mike Johnson | last post by:
I have the following code in form1 and when the application starts this sub is called to check for a path if not found a message box is displayed and then gives the user an option to end the application but when this option is selected the application does not end but continues to the next line of code which tries to setup a filewatcher with...
3
1665
by: marciocamurati | last post by:
Hi, I have a problem with my application exit, I create a button that call another form and close my application: Private Sub closeApplication() Dim Status As New Status status.Show() Application.Exit()
4
1949
by: Chip | last post by:
Can somebody explain to me why my process continues to run after I halt execution? This plays havoc with debugging. I expect to be starting a new instance at the beginning of a loop and the first break point hit is thousands of itterations into the process (from a previous instance). I get a very random step behavior. Know I am watching a...
4
1501
by: J Ames | last post by:
I have a VB.NET 2005 app I'm developing. I've created a mail class library and I'm making a reference to it in my code. All of that works fine. The object is called when a certain condition is met in the code, and after calling that method I want the app to terminate. So...I figured Me.Close and Application.Exit would do the trick. ...
1
5095
by: =?Utf-8?B?VGFvZ2U=?= | last post by:
Hi All, When I use applcation.exit() in winForm application, the form closed, but the process is still going!! ( The debug process is still running if debug in VS IDE). Environment.Exit(0) works fine. But how to do in such following scenario: if I need to give 2 option for user,1. Quit 2. Restart. In Quit option, I use Environment.Exit(0) to...
0
7659
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7580
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7945
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6244
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5481
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3618
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2079
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1194
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
916
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.