Force application to wait for WinExec to complete

How to make my application wait for WinExec to complete?

+3
source share
3 answers

WinExec is no longer recommended. You can use CreateProcessand WaitForSingleObject, as shown in the example, when creating processes.

+12
source

Strictly speaking, you cannot. WinExecwill return as soon as possible (see the "Notes" section of the WinExec MSDN page ), and, unlike CreateProcess, it will not even return a handle that you can call WaitForSingleObject.

+2
source

WinExec 16- Windows. - system():

#include <stdlib.h>

int main() {
    system( "notepad" );
    // only gets to here when the notepad instance is closed
}
+1
source

Source: https://habr.com/ru/post/1732621/


All Articles