473,698 Members | 2,225 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 5930
"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
5945
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 was given as an argument to Application.Run?
1
17695
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 either). To counteract this I have decided to use the Environment.exit(-1) method instead. What...
6
20078
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 the Threads
22
2243
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
1555
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 the path which does not exist, which then gives an error. please help. Public Sub Check_For_Dir()...
3
1673
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
1956
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 database continue to be updated 10 minutes after I stopped the front-end process. I have to stop IIS...
4
1513
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. However, these lines are just ignored! In debugger it appears as though they are executed, but the...
1
5106
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 confirm the process will be stopped. In Restart option, I can't use Environment.Exit(0) , because...
0
8603
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9157
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8861
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6518
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4366
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4619
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2328
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2001
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.