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. CreateProcess error

CreateProcess error

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

    Hi everyone. I'm having a problem with the CreateProcess routine. I'm calling using the following: if (CreateProcess(cmdArg, cmdFileName, NULL, NULL, TRUE, DETACHED_PROCESS /*CREATE_NEW_CONSOLE */, NULL, NULL, &si, &pi) != 0){ CloseHandle(pi.hThread); CloseHandle(pi.hProcess); } It works absolutely perfrect with the execption of one thing, the Application calling this doesn't return from the CreateProcess call until the process created returns. :confused: I really need the Call to return so I can shut down the calling Process after I'm done. I looked at using WinExec but that doesn't return either. What am I missing here? What method should I use? Thanks!

    D 1 Reply Last reply
    0
    • W will1383

      Hi everyone. I'm having a problem with the CreateProcess routine. I'm calling using the following: if (CreateProcess(cmdArg, cmdFileName, NULL, NULL, TRUE, DETACHED_PROCESS /*CREATE_NEW_CONSOLE */, NULL, NULL, &si, &pi) != 0){ CloseHandle(pi.hThread); CloseHandle(pi.hProcess); } It works absolutely perfrect with the execption of one thing, the Application calling this doesn't return from the CreateProcess call until the process created returns. :confused: I really need the Call to return so I can shut down the calling Process after I'm done. I looked at using WinExec but that doesn't return either. What am I missing here? What method should I use? Thanks!

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Something's not right in the hen house. Per the documentation, "...because CreateProcess() returns without waiting for the new process to finish its initialization."

      L 1 Reply Last reply
      0
      • D David Crow

        Something's not right in the hen house. Per the documentation, "...because CreateProcess() returns without waiting for the new process to finish its initialization."

        L Offline
        L Offline
        Lhenno Ferrari
        wrote on last edited by
        #3

        :wtf: OOPS... there is something wrong... CreateProcess() should return immediataly, and if you want to wait for the created process you must use : WaitForSingleObject(pi.hProcess, WAIT_OBJECT_0)... ?

        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