kill a process

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Wilfried Mestdagh

    kill a process

    Hi,

    I use C# 2005 beta with NET 2005 beta.
    How to kill a process ? Is this possible in this version ? I foundsom things
    in help but it is not clear to me, if someone can give me brief example it
    would be very appreciated.

    --
    rgds, Wilfried

  • David Levine

    #2
    Re: kill a process

    You can initiate a controlled shutdown by using Environment.Exi t() or
    returning from the last foreground of the application. For an instant
    shutdown, not recommended, you can use
    System.Diagnost ics.Process.Get CurrentProcess( ).Kill().

    "Wilfried Mestdagh" <WilfriedMestda gh@discussions. microsoft.com> wrote in
    message news:DFF0681A-254D-43A2-B09B-8FAD76B9E3B1@mi crosoft.com...[color=blue]
    > Hi,
    >
    > I use C# 2005 beta with NET 2005 beta.
    > How to kill a process ? Is this possible in this version ? I foundsom
    > things
    > in help but it is not clear to me, if someone can give me brief example it
    > would be very appreciated.
    >
    > --
    > rgds, Wilfried
    > http://www.mestdagh.biz[/color]


    Comment

    • Wilfried Mestdagh

      #3
      Re: kill a process

      Hi,

      I'm sorry I was not clear in my question. Anyway thanks for this reply
      already. I want to kill another process wherre I know the .exe name from.

      rgds, Wilfried

      Comment

      • Bob Grommes

        #4
        Re: kill a process

        You need to look at the Process and ProcessInfo classes.

        Basically get a process object, usually by searching for the desired process
        by name (you can see the names in the task list). Then, call Kill() on that
        process instance. There are methods provided for attempting an orderly
        shutdown too, if the task has an event loop running.

        --Bob

        "Wilfried Mestdagh" <WilfriedMestda gh@discussions. microsoft.com> wrote in
        message news:A2C2F9E9-67B2-4FC4-8967-17AA819FA998@mi crosoft.com...[color=blue]
        > Hi,
        >
        > I'm sorry I was not clear in my question. Anyway thanks for this reply
        > already. I want to kill another process wherre I know the .exe name from.
        >
        > rgds, Wilfried[/color]


        Comment

        Working...