executing some other exe
-
How to execute an executing exe from VC++ ? and to pass the control back to the same program once the exe is closed.
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!
-
How to execute an executing exe from VC++ ? and to pass the control back to the same program once the exe is closed.
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!