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. executing some other exe

executing some other exe

Scheduled Pinned Locked Moved C / C++ / MFC
c++tutorialquestion
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
    Manju
    wrote on last edited by
    #1

    How to execute an executing exe from VC++ ? and to pass the control back to the same program once the exe is closed.

    M 2 Replies Last reply
    0
    • M Manju

      How to execute an executing exe from VC++ ? and to pass the control back to the same program once the exe is closed.

      M Offline
      M Offline
      Matthias 0
      wrote on last edited by
      #2

      Hi, you can do so by launching a process (with ::CreateProcess) and waiting until it's finished (with ::WaitForSingleObject). Here is how it could look like. This code is raw, add checks on return values and errorhandling. STARTUPINFO startupi; PROCESS_INFORMATION processi; ::CreateProcess(NULL, _T("C:\myexe.exe"), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &startupi, &processi); ::WaitForSingleObject(processi.hProcess, INFINITE); Check for the retval of the CreateProcess() function! Hope that helps!

      1 Reply Last reply
      0
      • M Manju

        How to execute an executing exe from VC++ ? and to pass the control back to the same program once the exe is closed.

        M Offline
        M Offline
        Matthias 0
        wrote on last edited by
        #3

        Hi, you can do so by launching a process (with ::CreateProcess) and waiting until it's finished (with ::WaitForSingleObject). Here is how it could look like. This code is raw, add checks on return values and errorhandling. STARTUPINFO startupi; PROCESS_INFORMATION processi; ::CreateProcess(NULL, _T("C:\myexe.exe"), NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, NULL, &startupi, &processi); ::WaitForSingleObject(processi.hProcess, INFINITE); Check for the retval of the CreateProcess() function! Hope that helps!

        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