我试图简单地使用下面的功能启动一个应用程序,但它似乎工作正常。它不会从桌面启动我的测试应用程序,但是当我将它移动到下载中的子文件夹时,它工作正常。我从配置文件中提取目录信息并考虑到我已经可以从单独的文件夹启动测试应用程序,我怀疑它与我的目录信息有什么关系。
bool StartTest(){
char WOW_PATH[MAX_PATH];
char WOW_PATH_FULL[MAX_PATH];
STARTUPINFO SUI;
PROCESS_INFORMATION PROCINFO;
SUI.cb = sizeof(STARTUPINFO);
SUI.lpReserved = 0;
SUI.lpTitle = 0;
SUI.dwFlags = STARTF_RUNFULLSCREEN;
SUI.wShowWindow = SW_SHOW;
SUI.cbReserved2 = 0;
SUI.lpReserved2 = 0;
ZeroMemory(&PROCINFO,sizeof(PROCINFO));
ifstream File;
File.open("config.txt");
File.getline(WOW_PATH,MAX_PATH);
File.close();
strcpy(WOW_PATH_FULL,WOW_PATH);
strcpy(WOW_PATH_FULL,"\Test.exe");
if(!CreateProcess(WOW_PATH_FULL,0,0,0,false,0,0,WOW_PATH,&SUI,&PROCINFO))
return 0;
CloseHandle(PROCINFO.hProcess);
CloseHandle(PROCINFO.hThread);
return 1;
}