lothos12345 Posted October 27, 2006 Posted October 27, 2006 i have written a visual basic.net 2003 application and upon it closing I want it to kill all instances of the application that are running, so I used the code below Dim proc() as Process proc = Process.GetProcessesByName("AppName") For Each SingleProcess as Process in Proc SingleProcess.Kill Next The above code works generally well but there are occasions when it will not close all instances of the application and I am not sure why. If anyone can shed some light as to the reason, it would be greatly appreiciated. Thanks Quote
Administrators PlausiblyDamp Posted October 27, 2006 Administrators Posted October 27, 2006 If you are killing all instances of the application - think about what will happen if this loop kills itself before the remaining instances are killed..... Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
Leaders snarfblam Posted October 28, 2006 Leaders Posted October 28, 2006 Just a question? Why are you killing the processes instead of simply closing them, i.e. SingleProcess.CloseMainWindow() Quote [sIGPIC]e[/sIGPIC]
lothos12345 Posted October 30, 2006 Author Posted October 30, 2006 If you are killing all instances of the application - think about what will happen if this loop kills itself before the remaining instances are killed..... You were absolutely correct it was killing itself before the it killed the other instances. Thanks for your help. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.