別のアプリケーションを開いて自己終了するアプリケーションを作成しようとしているので、外部アプリケーションが開いたときにコンソールは必要ありません
これは私がこれまでに試したことです:
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);
これは私がコンパイルする方法です:
g++ -o "launcher" "launcher.cpp" -mwindows