Stopping a program run from another

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ed Bitzer

    #1

    Stopping a program run from another

    You have taught me how to start another program using
    System.Diagnost ics.Process.Sta rt and suggested a good tip site and
    Google search for future reference. My problem now is how to stop
    that program I started. Even if I close my main program this program
    remains listed in the Task Manager. I promise you I searched but
    using words like end, stop, close found me lots of information but not
    my specific need. Appreciate if you would help again

    Ed


  • Chris Dunaway

    #2
    Re: Stopping a program run from another

    On Jul 6, 7:55 am, "Ed Bitzer" <edbit...@yahoo .comwrote:
    You have taught me how to start another program using
    System.Diagnost ics.Process.Sta rt and suggested a good tip site and
    Google search for future reference. My problem now is how to stop
    that program I started. Even if I close my main program this program
    remains listed in the Task Manager. I promise you I searched but
    using words like end, stop, close found me lots of information but not
    my specific need. Appreciate if you would help again
    >
    Ed
    Have you looked at the docs for the Process class? You might try
    Process.CloseMa inWindow or Process.Close.

    Good luck

    Chris

    Comment

    • Miro

      #3
      Re: Stopping a program run from another

      Something like this you are looking for ?

      Private Sub KillExcel()

      Dim myProcesses As Process
      Dim myProcess As Process

      myProcesses = Process.GetProc essesByName("EX CEL.EXE")
      For Each myProcess In myProcesses
      myProcess.Kill( )
      Next

      myProcesses = Nothing
      myProcess = Nothing

      End Sub

      Miro


      "Ed Bitzer" <edbitzer@yahoo .comwrote in message
      news:%23OqK0z8v HHA.4184@TK2MSF TNGP06.phx.gbl. ..
      You have taught me how to start another program using
      System.Diagnost ics.Process.Sta rt and suggested a good tip site and Google
      search for future reference. My problem now is how to stop that program I
      started. Even if I close my main program this program remains listed in
      the Task Manager. I promise you I searched but using words like end,
      stop, close found me lots of information but not my specific need.
      Appreciate if you would help again
      >
      Ed
      >

      Comment

      • rowe_newsgroups

        #4
        Re: Stopping a program run from another

        On Jul 6, 9:17 am, Chris Dunaway <dunaw...@gmail .comwrote:
        On Jul 6, 7:55 am, "Ed Bitzer" <edbit...@yahoo .comwrote:
        >
        You have taught me how to start another program using
        System.Diagnost ics.Process.Sta rt and suggested a good tip site and
        Google search for future reference. My problem now is how to stop
        that program I started. Even if I close my main program this program
        remains listed in the Task Manager. I promise you I searched but
        using words like end, stop, close found me lots of information but not
        my specific need. Appreciate if you would help again
        >
        Ed
        >
        Have you looked at the docs for the Process class? You might try
        Process.CloseMa inWindow or Process.Close.
        >
        Good luck
        >
        Chris
        What Chris means:

        Dim pi As New ProcessStartInf o("MyDialer.exe ", "123 456 1234")
        Dim p As Process = Process.Start(p i)
        '// I also find a System.Threadin g.Thread.Sleep( ...) is sometimes
        '// needed to allow the app to receive the close messages
        p.CloseMainWind ow
        p.Close

        Thanks,

        Seth Rowe

        Comment

        • =?Utf-8?B?TW9kZWxCdWlsZGVy?=

          #5
          RE: Stopping a program run from another

          You probably would do the suggestions above within the main form closing
          handler.

          "Ed Bitzer" wrote:
          You have taught me how to start another program using
          System.Diagnost ics.Process.Sta rt and suggested a good tip site and
          Google search for future reference. My problem now is how to stop
          that program I started. Even if I close my main program this program
          remains listed in the Task Manager. I promise you I searched but
          using words like end, stop, close found me lots of information but not
          my specific need. Appreciate if you would help again
          >
          Ed
          >
          >
          >

          Comment

          • Ed Bitzer

            #6
            Re: Stopping a program run from another


            "Ed Bitzer" <edbitzer@yahoo .comwrote in message
            news:%23OqK0z8v HHA.4184@TK2MSF TNGP06.phx.gbl. ..
            You have taught me how to start another program using
            System.Diagnost ics.Process.Sta rt and suggested a good tip site and
            Google search for future reference. My problem now is how to stop
            that program I started. Even if I close my main program this
            program remains listed in the Task Manager. I promise you I
            searched but using words like end, stop, close found me lots of
            information but not my specific need. Appreciate if you would help
            again
            >
            Ed
            >
            Here is the code I finally settled upon inserted in the Form.Closed
            sub - I will try the other ideas suggested to gain some better
            understanding.
            For Each oProcess2 In System.Diagnost ics.Process.Get Processes()
            If oProcess2.Proce ssName.ToString = "phonepro" Then
            oProcess2.Kill( )
            MessageBox.Show ("Process started from code is now
            killed")
            Exit For
            End If
            Next
            Application.Exi t() '

            Ed




            Comment

            • Rad [Visual C# MVP]

              #7
              Re: Stopping a program run from another

              On Fri, 6 Jul 2007 08:55:24 -0400, "Ed Bitzer" <edbitzer@yahoo .com>
              wrote:
              >You have taught me how to start another program using
              >System.Diagnos tics.Process.St art and suggested a good tip site and
              >Google search for future reference. My problem now is how to stop
              >that program I started. Even if I close my main program this program
              >remains listed in the Task Manager. I promise you I searched but
              >using words like end, stop, close found me lots of information but not
              >my specific need. Appreciate if you would help again
              >
              >Ed
              >
              Perhaps you should first figure out why the called program does not
              close cleanly ... is it supposed to terminate itself when it has
              completed its operation?

              --

              Comment

              Working...