Wednesday, December 14, 2005

Kill a process in VB.NET

I have had problems with processes that are not closed correctly. This is what I've done after trying to close it the correct way to ensure it is killed. In this case it is Acrobat that I have run.
res = AcroExchAVDoc.Close(False)
Dim myProcesses As Process() = Process.GetProcessesByName("acrobat")
Dim myProcess As Process
For Each myProcess In myProcesses
If myProcess.MainWindowTitle = "" Then myProcess.Kill()
Next myProcess

PS. I have not tried this yet but it could be worth trying to use Marshal.FinalReleaseComObject(AcroExchAVDoc)

2 comments:

Some of the latest blog posts

Subscribe to RSS headline updates from:
Powered by FeedBurner

Contact Us | About JTB World | Subscribe to this blog
JTB World's website | Website General Terms of Use | Privacy Policy
^ Top of page

© 2004- JTB World. All rights reserved.