Thread: How to find out if a process is running (by name)

  1. #1
    Registered User
    Join Date
    Nov 2011
    Posts
    2

    How to find out if a process is running (by name)

    Hi,

    In Task Manage (process tab), I can see a program (ie abc.exe) is running.

    I wish to find out using win API calls to see if abc.exe is running.

    I would be greatfull if someone can help me.

    Thanks

  2. #2
    Banned
    Join Date
    Aug 2010
    Location
    Ontario Canada
    Posts
    9,547
    This isn't as easy as it should be... About the only way is to enumerate the top level windows on your desktop and find it's window title...

    EnumWindows()

    As far as a know there is no way to directly ask "Is myprog.exe running".

  3. #3
    'Allo, 'Allo, Allo
    Join Date
    Apr 2008
    Posts
    639
    It's easier to use CreateToolhelp32Snapshot and Process32First/Next to enum the processes while examining ProcessEntry32::szExeFile as you go.

  4. #4
    Registered User
    Join Date
    Nov 2011
    Posts
    2
    Hi CommonTater and adeybue,

    Thanks you both for your valued comments. It worked fine using CreateToolhelp32Snapshot method.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My own terminal > Running a background process
    By tiestodj in forum C Programming
    Replies: 3
    Last Post: 03-06-2010, 03:30 AM
  2. Check Running Process Dev-C++
    By gamesplant in forum Windows Programming
    Replies: 23
    Last Post: 10-19-2009, 03:20 AM
  3. [c++] check if a process is already running
    By liquid_ice in forum Linux Programming
    Replies: 0
    Last Post: 05-12-2009, 03:30 AM
  4. How to check if own created process is still running
    By s-men in forum Windows Programming
    Replies: 3
    Last Post: 01-24-2009, 11:39 AM
  5. Getting VmSize of a running process
    By ruairi in forum Linux Programming
    Replies: 1
    Last Post: 04-07-2003, 10:39 AM