fix launching with command line args

This commit is contained in:
seraphima
2024-06-24 16:34:17 +02:00
parent 17a607fda0
commit c89b4bb9fd

View File

@@ -130,7 +130,7 @@ namespace FancyZones
}
}
bool LaunchApp(const std::wstring& appPath, std::wstring commandLineArgs)
bool LaunchApp(const std::wstring& appPath, const std::wstring& commandLineArgs)
{
STARTUPINFO startupInfo;
ZeroMemory(&startupInfo, sizeof(startupInfo));
@@ -139,7 +139,8 @@ bool LaunchApp(const std::wstring& appPath, std::wstring commandLineArgs)
PROCESS_INFORMATION processInfo;
ZeroMemory(&processInfo, sizeof(processInfo));
if (CreateProcess(appPath.c_str(), commandLineArgs.data(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startupInfo, &processInfo))
std::wstring fullCommandLine = L"\"" + appPath + L"\" " + commandLineArgs;
if (CreateProcess(nullptr, fullCommandLine.data(), nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startupInfo, &processInfo))
{
CloseHandle(processInfo.hProcess);
CloseHandle(processInfo.hThread);