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. Process Handle given Process ID

Process Handle given Process ID

Scheduled Pinned Locked Moved C / C++ / MFC
question
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.
  • M Offline
    M Offline
    mspitzer
    wrote on last edited by
    #1

    This may be something simple, but I can't seem to find it anywhere. Does anyone know of a way to get a handle to a process if I know the process ID? What I am trying to do is see if the process is still active by calling GetExitCodeProcess. I am getting the PID by enumerating the processes that are running at a certain time. Technically I could just run through all the running processes everytime I wanted to know if the process was running and compare PIDs, but that seems like overkill. It would be much simpler just to get the handle once, and check at anytime in the future using GetExitCodeProcess. Thanks, Mike

    D 1 Reply Last reply
    0
    • M mspitzer

      This may be something simple, but I can't seem to find it anywhere. Does anyone know of a way to get a handle to a process if I know the process ID? What I am trying to do is see if the process is still active by calling GetExitCodeProcess. I am getting the PID by enumerating the processes that are running at a certain time. Technically I could just run through all the running processes everytime I wanted to know if the process was running and compare PIDs, but that seems like overkill. It would be much simpler just to get the handle once, and check at anytime in the future using GetExitCodeProcess. Thanks, Mike

      D Offline
      D Offline
      Daniel Turini
      wrote on last edited by
      #2

      Try HANDLE OpenProcess(DWORD dwDesiredAccess, // access flag BOOL bInheritHandle, // handle inheritance option DWORD dwProcessId // process identifier ); Crivo Automated Credit Assessment

      M 1 Reply Last reply
      0
      • D Daniel Turini

        Try HANDLE OpenProcess(DWORD dwDesiredAccess, // access flag BOOL bInheritHandle, // handle inheritance option DWORD dwProcessId // process identifier ); Crivo Automated Credit Assessment

        M Offline
        M Offline
        mspitzer
        wrote on last edited by
        #3

        Thanks. I don't know how I missed it. It was right in front of me the whole time. Having my 7 month old son (who is teething) :mad: yelling in my ear probably had something to do with it. Thanks again, Mike

        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