473,725 Members | 2,278 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 5936
"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
5946
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
17703
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
20083
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
2248
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
1561
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
1677
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
1961
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
1522
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
5112
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
8752
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
9257
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9179
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9116
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...
0
8099
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6702
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
6011
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();...
1
3228
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
3
2157
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.