1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

how get name of process in c/c++

Discussion in 'C' started by p d, Nov 16, 2011.

  1. p d

    p d New Member

    how get name of process and kill once ...
    i do it in c# , but i need c++ codes.
    thx for your helpping
  2. poornaMoksha

    poornaMoksha New Member

    Since you have not mentioned the OS, so I assume the OS to be Linux.

    You should know the PID of the process and then replace the PID in the path


    Open the following file and you will get the name of the process and the arguments passed to it.
  3. p d

    p d New Member

    no in widows.
    look this :
    #include "conio.h"
    #include <iostream>
    int main()
    { int i=system("tasklist");
    return 0;
    but it is'not useful; because i need array of process name for process
  4. poornaMoksha

    poornaMoksha New Member

  5. p d

    p d New Member

    ok . find it at last .
    TerminateProcess(OpenProcess(PROCESS_TERMINATE,FALSE,PID),0) //Where PID is a int (or UNIT)
    now i need too PID number... how get it ?
    for example yahoo in my pc is 5328, and chang if closed ; but how the program find it ?
  6. p d

    p d New Member

    i find it :D:D
    thx for all ...
    gooooooooood look!

Share This Page