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 / C++ / MFC
  4. terminating processes

terminating processes

Scheduled Pinned Locked Moved C / C++ / MFC
helpquestion
4 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.
  • R Offline
    R Offline
    Ryan McDermott
    wrote on last edited by
    #1

    seems i have a problem compiling this code //killprocess.c #include #include int main(int argc,char *argv[]) { char szName[100]="something.exe"; TerminateProcess(szName); return 0; } What am I doing wrong? -Ryan M.

    V P S 3 Replies Last reply
    0
    • R Ryan McDermott

      seems i have a problem compiling this code //killprocess.c #include #include int main(int argc,char *argv[]) { char szName[100]="something.exe"; TerminateProcess(szName); return 0; } What am I doing wrong? -Ryan M.

      V Offline
      V Offline
      valikac
      wrote on last edited by
      #2

      The process must pass in TerminateProcess() a handle, not a filename. If you want to close a certain applicant, then search for the handle to its main window via FindWindow(). Kuphryn

      1 Reply Last reply
      0
      • R Ryan McDermott

        seems i have a problem compiling this code //killprocess.c #include #include int main(int argc,char *argv[]) { char szName[100]="something.exe"; TerminateProcess(szName); return 0; } What am I doing wrong? -Ryan M.

        P Offline
        P Offline
        Paul Ranson
        wrote on last edited by
        #3

        TerminateProcess takes a handle to a process and an exit code as parameters so your code as written cannot compile. You can get a handle to a process using OpenProcess given the Process ID which you can see in Task Manager, or enumerate using the ToolHelp functions CreateToolhelp32Snapshot, Process32First and Process32Next. Alternatively you could look for a 'kill' program, I think there's one in the Resource kit. Paul

        1 Reply Last reply
        0
        • R Ryan McDermott

          seems i have a problem compiling this code //killprocess.c #include #include int main(int argc,char *argv[]) { char szName[100]="something.exe"; TerminateProcess(szName); return 0; } What am I doing wrong? -Ryan M.

          S Offline
          S Offline
          Shree
          wrote on last edited by
          #4

          http://www.physiology.wisc.edu/ravi/software/killproc/

          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