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. C / C++ / MFC
  4. How to get process id given the process name

How to get process id given the process name

Scheduled Pinned Locked Moved C / C++ / MFC
jsonhelptutorialquestion
3 Posts 2 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.
  • G Offline
    G Offline
    g3e
    wrote on last edited by
    #1

    Hi, From within my application i need to wait for an external process to complete before proceeding. But all i have is the external process's name. Is there any API that returns the process id or handle given the process name ?? I tried using CreateToolhelp32Snapshot but it does not seem to work in VC41 in which my application is built. It works fine in VC6 though. Thanks for ur help.

    C 1 Reply Last reply
    0
    • G g3e

      Hi, From within my application i need to wait for an external process to complete before proceeding. But all i have is the external process's name. Is there any API that returns the process id or handle given the process name ?? I tried using CreateToolhelp32Snapshot but it does not seem to work in VC41 in which my application is built. It works fine in VC6 though. Thanks for ur help.

      C Offline
      C Offline
      Carlos Antollini
      wrote on last edited by
      #2

      You can not to get the Handle of the process from the process name, you need to do the contrary. You must to enum the process handles or Ids and the get the process name You need to use the psapi.dll library. You must to use the EnumProcessModules function and then the GetModuleFileNameEx function to get the filename of each process. Regards Carlos Antollini Do you know piFive[^] ?

      G 1 Reply Last reply
      0
      • C Carlos Antollini

        You can not to get the Handle of the process from the process name, you need to do the contrary. You must to enum the process handles or Ids and the get the process name You need to use the psapi.dll library. You must to use the EnumProcessModules function and then the GetModuleFileNameEx function to get the filename of each process. Regards Carlos Antollini Do you know piFive[^] ?

        G Offline
        G Offline
        g3e
        wrote on last edited by
        #3

        Thanks a lot. That works.

        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