#include <stdio.h>#include <Windows.h>static BOOL mkProc(const char *path, LPSTR cmd) { STARTUPINFO info={sizeof(info)}; PROCESS_INFORMATION processInfo; return CreateProcess(path, cmd, NULL, NULL, TRUE, 0, NULL, NULL, &info, &processInfo);}static const char *commands[] = { "m.exe", "n.exe", NULL};int main(int argc, char **argv) { for (int i = 0; commands[i]; ++i) { LPSTR cmd = (LPSTR) commands[i]; if (!mkProc(NULL, cmd)) { fprintf(stderr, "ERROR: cannot spawn %s\n", cmd); } } return 0;}
这段c++ 启动exe 程序 为什么会出现一个黑框?
解决方案
#pragma comment( linker, "/subsystem:windows /entry:mainCRTStartup" )
程序的开头加入这个就可以不显示窗口了