I'm trying to write an application to open another and self close, so I don't need the console when the external application opens
This is what I've tried so far:
system("cmd.exe /c application.exe"); //console shows, application opens, console wait
system("start \"\" application.exe"); //console shows, application opens, console close
//console does not show but neither the application (I can see it in task manager)
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_HIDE;
ZeroMemory(&pi, sizeof(pi));
CreateProcess(0, "application.exe", 0, 0, FALSE, 0, 0, 0, &si, &pi);
//console does not show but neither the application (I can see it in task manager)
WinExec("application.exe", SW_HIDE);
This is the way I compile:
g++ -o "launcher" "launcher.cpp" -mwindows