diff --git a/.gitignore b/.gitignore index eb7f048..3a3e1c0 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .vscode/ +.vs/ *.exe diff --git a/unlockfps/main.cpp b/unlockfps/main.cpp index 5a08f05..132b4bd 100644 --- a/unlockfps/main.cpp +++ b/unlockfps/main.cpp @@ -682,7 +682,15 @@ int main(int argc, char** argv) STARTUPINFOA si{}; PROCESS_INFORMATION pi{}; - if (!CreateProcessA(ProcessPath.c_str(), (LPSTR)CommandLine.c_str(), nullptr, nullptr, FALSE, 0, nullptr, ProcessDir.c_str(), &si, &pi)) + + // 构建完整的命令行:可执行文件路径 + 参数 + std::string FullCommandLine = "\"" + ProcessPath + "\""; + if (!CommandLine.empty()) + { + FullCommandLine += " " + CommandLine; + } + + if (!CreateProcessA(nullptr, (LPSTR)FullCommandLine.c_str(), nullptr, nullptr, FALSE, 0, nullptr, ProcessDir.c_str(), &si, &pi)) { DWORD code = GetLastError(); printf("CreateProcess failed (%d): %s", code, GetLastErrorAsString(code).c_str());