Closing Processes

Do you guys know of a good way to close a process, such as an adobe acrobat process that has been started programmatically
Here is some code I've found (for starting and printing a pdf file), and it works fine, but it leaves the acrobat reader running and I want to be able to close it out. I believe getting the process ID and closing it out that way might be the way to go, but not sure. Any help is much appreciated...thanks guys!


        Dim filename As String = "C:\Temp\Test.pdf"
        Dim proc As New Process
        Dim procs As Process()

        Dim startInfo As New ProcessStartInfo("C:\Program Files\Adobe\Acrobat 6.0\Reader\AcroRd32.exe")
        startInfo.FileName = filename
        startInfo.Verb = "print"

        Process.Start(startInfo)

        procs = proc.GetProcessesByName("AcroRd32.exe")

        If procs.Length = 0 Then
            'do nothing

        Else

            Dim i As Integer = 0
            For i = 0 To UBound(procs)
                procs(i).Close()
                procs(i).WaitForExit()
            Next

        End If


Answer this question

Closing Processes

  • KhaderM

    Can't you call <strong>Kill()</strong> after Close()
  • Curtis111

    If you can't do what the above user suggested, there's a method in the Win32 API you could call that would do the trick.  (You'd have to have to process ID)
  • Closing Processes