How to Kill a Process That Is Running in VB6

Written by joseph mars
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to Kill a Process That Is Running in VB6
Kill processes in Visual Basic 6.0 with a few basic steps. (Jupiterimages/Brand X Pictures/Getty Images)

Visual Basic 6.0 is a programming language created by the Microsoft corporation. It uses the Beginner's All-purpose Symbolic Instruction Code (BASIC) language to help you program graphical environments, in addition to allowing you to add buttons and text boxes within the program to customise your work. When you are running a certain process within 6.0, you may want to stop it at some point. Kill a 6.0 process by typing in a few commands within the program.

Skill level:

Things you need

  • Pencil
  • Paper

Show MoreHide


  1. 1

    Click the process in Visual Basic 6.0 you want to stop to highlight it, and type "target_hwnd = FindWindow" into the program. Press "Enter" or "Return" to view the process' window handle, and write this information down with the pencil and paper.

  2. 2

    Type "GetWindowThreadProcessId target_hwnd, target_process_id" and press "Enter" or "Return" to find the process' identification, and write it down with the pencil and paper.

  3. 3

    Open the process' handle by typing in "target_process_handle = OpenProcess" and pressing "Enter" or "Return." Write the handle down with the pencil and paper.

  4. 4

    Use the names you wrote down for the target handle, process identification and process handle to terminate the process; for example, if "Cheap Rental" appeared as the name for all three names, then type it in where appropriate after the first line of code, pressing "Enter" or "Return" after you type in each line:

    "Private Sub cmdTerminate_Click()"

    "Dim target_hwnd Cheap Rental"

    "Dim target_process_id Cheap Rental"

    "Dim target_process_handle Cheap Rental"

  5. 5

    Type "End" and press "Enter" or "Return" to terminate the process.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.