Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. How to kill a process and a specific handle of process in C#

How to kill a process and a specific handle of process in C#

Scheduled Pinned Locked Moved C#
csharptutorial
9 Posts 4 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mushtaque Nizamani
    wrote on last edited by
    #1

    Hi, Is there any way to kill a process and to close only a handle of a process(not complete process).

    C M V 3 Replies Last reply
    0
    • M Mushtaque Nizamani

      Hi, Is there any way to kill a process and to close only a handle of a process(not complete process).

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      A handle is representative of an object, how would you close a handle, but not the object it represents ?

      Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

      M 1 Reply Last reply
      0
      • C Christian Graus

        A handle is representative of an object, how would you close a handle, but not the object it represents ?

        Christian Graus - Microsoft MVP - C++ "I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )

        M Offline
        M Offline
        Mushtaque Nizamani
        wrote on last edited by
        #3

        your are right, but the Process Explorer(Sys Internal) supports to close the handle too, i wonder how did the Process Explorer team achieve that task. I am sorry if have done some english grammatical mistakes. Regards, Mushq

        1 Reply Last reply
        0
        • M Mushtaque Nizamani

          Hi, Is there any way to kill a process and to close only a handle of a process(not complete process).

          M Offline
          M Offline
          Martin 0
          wrote on last edited by
          #4

          Hello, Killing a process is possible over the System.Diagnostics.Process class. (method kill) To get the process you could use GetProcessByName method.

          Mushq wrote:

          and to close only a handle of a process

          I think you have to specify a little more what you whant to do. All the best, Martin

          M 1 Reply Last reply
          0
          • M Martin 0

            Hello, Killing a process is possible over the System.Diagnostics.Process class. (method kill) To get the process you could use GetProcessByName method.

            Mushq wrote:

            and to close only a handle of a process

            I think you have to specify a little more what you whant to do. All the best, Martin

            M Offline
            M Offline
            Mushtaque Nizamani
            wrote on last edited by
            #5

            Thanx, I have got the answer of my first part of question that how to kill a process, and about handle, for that i am taking particular example of Explorer.exe process, I have created Test folder in C dervice, and Test Folder in D Derive, and i have opened both of them simultaneously, Explorer.exe process has got handle of both these opened folder, when i search C:\Test in process explorer(Sys Internals), then it shows me that explorer.exe has loaded the handle C:\Test Folder. I am sorry if have done some english grammatical or spelling mistakes. Regards, Mushq

            M 1 Reply Last reply
            0
            • M Mushtaque Nizamani

              Hi, Is there any way to kill a process and to close only a handle of a process(not complete process).

              V Offline
              V Offline
              Vasudevan Deepak Kumar
              wrote on last edited by
              #6

              There is a utility called 'TaskManager Extension' in CodeProject. I think that should be able to address your requirement. Since the code is also there, you should be able to follow this requirement soon. Check out http://www.codeproject.com/system/Task_Manager_Extension.asp[^]

              Vasudevan Deepak Kumar Personal Homepage Tech Gossips

              1 Reply Last reply
              0
              • M Mushtaque Nizamani

                Thanx, I have got the answer of my first part of question that how to kill a process, and about handle, for that i am taking particular example of Explorer.exe process, I have created Test folder in C dervice, and Test Folder in D Derive, and i have opened both of them simultaneously, Explorer.exe process has got handle of both these opened folder, when i search C:\Test in process explorer(Sys Internals), then it shows me that explorer.exe has loaded the handle C:\Test Folder. I am sorry if have done some english grammatical or spelling mistakes. Regards, Mushq

                M Offline
                M Offline
                Martin 0
                wrote on last edited by
                #7

                Hello, I'm just curious, so please don't think I'm rude. But have you voted me down couse I haven't answered you second question? If yes! I didn't take time, cause I have work to do and I thought the answere from Vasudevan Deepak Kumar [^] should help you enough! If not, sorry for asking! All the best, Martin

                M 1 Reply Last reply
                0
                • M Martin 0

                  Hello, I'm just curious, so please don't think I'm rude. But have you voted me down couse I haven't answered you second question? If yes! I didn't take time, cause I have work to do and I thought the answere from Vasudevan Deepak Kumar [^] should help you enough! If not, sorry for asking! All the best, Martin

                  M Offline
                  M Offline
                  Mushtaque Nizamani
                  wrote on last edited by
                  #8

                  I hadn't rated your answer down, i have given 5/5, you can check that there are two votes have been given to your message, i have given 5/5, and there is some one else who has rated that down, even i have replied that message with thanks. I hope it is clear now :) sorry for my english if it is not correct! Best Regards, Mushq

                  M 1 Reply Last reply
                  0
                  • M Mushtaque Nizamani

                    I hadn't rated your answer down, i have given 5/5, you can check that there are two votes have been given to your message, i have given 5/5, and there is some one else who has rated that down, even i have replied that message with thanks. I hope it is clear now :) sorry for my english if it is not correct! Best Regards, Mushq

                    M Offline
                    M Offline
                    Martin 0
                    wrote on last edited by
                    #9

                    Mushq wrote:

                    I hadn't rated your answer down, i have given 5/5, you can check that there are two votes have been given to your message, i have given 5/5, and there is some one else who has rated that down, even i have replied that message with thanks.

                    I was assuming this! Again, I'm really sorry for asking but I'm allways a little confused when I get downvoted with no explination! Thanks for your time All the best, Martin

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups