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. Process

Process

Scheduled Pinned Locked Moved C / C++ / MFC
help
4 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.
  • S Offline
    S Offline
    Subramaniam s V
    wrote on last edited by
    #1

    Hi All, I have a small problem with the code snippet below. Can anyone help me out in this. I launched Internet Explorer as a process from my application. I closed the Internet Explorer using the close button and when I use the following code of "OpenProcess", the method still works(meaning that the method is able to the open the process with the specified ID. HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier); if(p != NULL) MessageBox(_T("Please check patient context"),_T("EDMS context change"),MB_OK); can anyone give some info on this please.

    N 1 Reply Last reply
    0
    • S Subramaniam s V

      Hi All, I have a small problem with the code snippet below. Can anyone help me out in this. I launched Internet Explorer as a process from my application. I closed the Internet Explorer using the close button and when I use the following code of "OpenProcess", the method still works(meaning that the method is able to the open the process with the specified ID. HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier); if(p != NULL) MessageBox(_T("Please check patient context"),_T("EDMS context change"),MB_OK); can anyone give some info on this please.

      N Offline
      N Offline
      Naveen
      wrote on last edited by
      #2

      Please try the below method HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier); DWORD dwEitCode = 0; if( 0 != hProcess) { GetExitCodeProcess( p,&dwEitCode ); if( ( STILL_ACTIVE == dwEitCode ) { // process is alive } else { // process is dead } Closehandle( p ) } nave

      S 1 Reply Last reply
      0
      • N Naveen

        Please try the below method HANDLE p = OpenProcess(PROCESS_ALL_ACCESS, FALSE, dwProcessIdentifier); DWORD dwEitCode = 0; if( 0 != hProcess) { GetExitCodeProcess( p,&dwEitCode ); if( ( STILL_ACTIVE == dwEitCode ) { // process is alive } else { // process is dead } Closehandle( p ) } nave

        S Offline
        S Offline
        Subramaniam s V
        wrote on last edited by
        #3

        Thanks Naveen. Its working as expected. Could you please tell me what was wrong with my code that I used. I had also checked for NULL of that Handle returned right?

        N 1 Reply Last reply
        0
        • S Subramaniam s V

          Thanks Naveen. Its working as expected. Could you please tell me what was wrong with my code that I used. I had also checked for NULL of that Handle returned right?

          N Offline
          N Offline
          Naveen
          wrote on last edited by
          #4

          I too don't know. But just think.. if OpenProcess return NULL if the process dosen't exists, what's the significants of GetExitCodeProcess() api.. I too was facing the same problem some months back. nave

          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