I\'ve been trying to create a process with CreateProcess() using the Windows API of course. I haven\'t been able to create a new console for some reason even after scouring
CREATE_NEW_CONSOLE
is a flag of CreateProcess()
itself, not of STARTUPINFO
. You are putting the flag in the wrong place. Try this instead:
int create_process( process * p, const char * exe_path, const char * cmd_line_args )
{
...
return CreateProcessA(
exe_path,
cmd_line_args,
NULL,
NULL,
FALSE,
CREATE_NEW_CONSOLE, // <-- here
NULL,
NULL,
&p->s_info,
&p->p_info
);
}
Also, keep in mind that a STARTUPINFOEX
can be passed to CreateProcess()
, so your create_process()
function should not be forcing p->s_info.cb
, that should be the caller's responsibility depending on whether a STARTUPINFO
or a STARTUPINFOEX
is being used.