HighTechTalks DotNet Forums  

Exiting an app

Dotnet Framework (SDK) microsoft.public.dotnet.framework.sdk


Discuss Exiting an app in the Dotnet Framework (SDK) forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
David Thielen
 
Posts: n/a

Default Exiting an app - 08-10-2009 , 04:46 PM






Hi;

We have an applet that we show in the icon-tray part of the toolbar.
When a user clicks exit on it's menu, we call Close() on the main
form. In XP this exits the app.

But in Vista and Windows 7, while the app disappears from the icon
tray, it is still running as a process. What else do we need to do to
cause our app to exit.

The app does have 2 worker threads and an open named pipe - but all of
those are shut down in the FormClosing event.

??? - thanks - dave

david@at-at-at (AT) windward (DOT) dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Reply With Quote
  #2  
Old   
Colbert Zhou [MSFT]
 
Posts: n/a

Default RE: Exiting an app - 08-11-2009 , 06:04 AM






Hi Dave,

So you are using NotifyIcon to do this, right? I follow the this MSDN
article and do test in both of Windows7 and Vista system.
http://msdn.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx

But I cannot reproduce the issue you mentioned. As long as I right click
the icon tray and click the Exit menu item. The line this.Close() will make
the form close and application quit. So I think the behavior you see must
have something to do with other codes implementation in your project. To do
a future investigation, when the application is still running as a process
background, you can use Visual Studio to attach that process and observe
its call stack. That may give some clues on what the process is doing.

By the way, instead of calling this.Close() only, I suggest we also call
Application.Exit afterward. Closing a form may not end all threads and
process operation. But the Application.Exit should ends the application
correctly.


Best regards,
Colbert Zhou
Microsoft Online Support Team

Reply With Quote
  #3  
Old   
David Thielen
 
Posts: n/a

Default Re: Exiting an app - 08-23-2009 , 02:41 PM



On Tue, 11 Aug 2009 11:04:33 GMT, colbertz (AT) online (DOT) microsoft.com
(Colbert Zhou [MSFT]) wrote:

Quote:
Hi Dave,

So you are using NotifyIcon to do this, right? I follow the this MSDN
article and do test in both of Windows7 and Vista system.
http://msdn.microsoft.com/en-us/library/system.windows.forms.notifyicon.aspx

But I cannot reproduce the issue you mentioned. As long as I right click
the icon tray and click the Exit menu item. The line this.Close() will make
the form close and application quit. So I think the behavior you see must
have something to do with other codes implementation in your project. To do
a future investigation, when the application is still running as a process
background, you can use Visual Studio to attach that process and observe
its call stack. That may give some clues on what the process is doing.

By the way, instead of calling this.Close() only, I suggest we also call
Application.Exit afterward. Closing a form may not end all threads and
process operation. But the Application.Exit should ends the application
correctly.
Hi;

Ok, in the FormClosed event we call Application.Exit() - but it is
still alive as a process. This problem only occurs on Vista & Windows
7 - it exits fine on XP.

We do have some worker threads, but we are closing all of them.

We also have some named pipes open (in worker threads), but we close
them.

??? - thanks - dave

david@at-at-at (AT) windward (DOT) dot.dot.net
Windward Reports -- http://www.WindwardReports.com
me -- http://dave.thielen.com

Cubicle Wars - http://www.windwardreports.com/film.htm

Reply With Quote
  #4  
Old   
Colbert Zhou [MSFT]
 
Posts: n/a

Default Re: Exiting an app - 08-26-2009 , 04:34 AM



Hi Dave,

Have you tried to use Visual Studio to attach to the background process and
break it down. Then, we can observe the Threads window to see what the
process is doing. We can also get each thread's callstack by double
clicking the specified thread in the Thread window. The callstack may give
us some further clues.

And is it possible to give me a reproduce project so that I can investigate
the issue on my local Vista PC and try to find the root problem here.
Contact

Have a nice day!


Best regards,
Colbert Zhou
Microsoft Online Support Team
----------------------------------------------
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg (AT) microsoft (DOT) com.

Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.