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
  1. Home
  2. General Programming
  3. Visual Basic
  4. Could you tell me how to kill a existing process from another program ?

Could you tell me how to kill a existing process from another program ?

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
6 Posts 4 Posters 0 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.
  • D Offline
    D Offline
    DengJW
    wrote on last edited by
    #1

    IN Visual Basic 6? Thanks JW DJ

    H M D 3 Replies Last reply
    0
    • D DengJW

      IN Visual Basic 6? Thanks JW DJ

      H Offline
      H Offline
      Hesham Amin
      wrote on last edited by
      #2

      Hi try TerminateProcess API function BOOL TerminateProcess(HANDLE hProcess,UINT uExitCode)

      1 Reply Last reply
      0
      • D DengJW

        IN Visual Basic 6? Thanks JW DJ

        M Offline
        M Offline
        Michael Combs
        wrote on last edited by
        #3

        You'll need the ToolHelp32 or PSAPI files depending on which OS you want to support. There are a variety of functions in those that allow you to list processes, terminate processes, etc.

        D 1 Reply Last reply
        0
        • M Michael Combs

          You'll need the ToolHelp32 or PSAPI files depending on which OS you want to support. There are a variety of functions in those that allow you to list processes, terminate processes, etc.

          D Offline
          D Offline
          DengJW
          wrote on last edited by
          #4

          thanks DJ

          M 1 Reply Last reply
          0
          • D DengJW

            thanks DJ

            M Offline
            M Offline
            Michael Combs
            wrote on last edited by
            #5

            You'll have to download PSAPI: http://www.microsoft.com/downloads/details.aspx?FamilyID=3d1fbaed-d122-45cf-9d46-1cae384097ac&DisplayLang=en There is function in there which lists processes. If I remember correctly, I think it uses a callback, but that may only be for 16-bit processes. There is also a function that will allow you to terminate a process. You'll have to put the dll on your target machine and declare the functions in your vb code.

            1 Reply Last reply
            0
            • D DengJW

              IN Visual Basic 6? Thanks JW DJ

              D Offline
              D Offline
              Duncan Edwards Jones
              wrote on last edited by
              #6

              Yopu might try posting a wm_close message to it's main window first - this will allow it to do any proper cleanup like closing files etc. Ideally you should only terminate a process using Terminateprocess if it has hung...IMHO. '--8<------------------------ Ex Datis: Duncan Jones Merrion Computing Ltd

              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