I am using main.exe for my program in C++, which then calls other executables in some situations.
How do I make an exe pause until another exe is executed?
Example:
I have an exe which creates dialog boxes for different situations (error, invalid arg, etc). Sometimes I might take an arg from the user & sometimes I might not.
So, until I take the arg from user how do I make my main.exe pause? Also, I want the arg in another exe.
So should I use new for storing the arg dynamically & pass pointers to that memory location in whichever exe I need the arg? By doing this am I doing memory leak? I will use delete after my need of that arg is over.
To do this on Windows you need to spawn your process with
CreateProcess()then wait on the handle that is returned in thePROCESS_INFORMATIONstructure usingWaitForSingleObject.Just ensure that the
CreateProcesscall succeeds. Any parameters can be passed via the command line or by using shared memory or a named pipe, see this for an example.