I have an .exe which takes 2 arguments. I need to run the .exe file between my program in runtime. I have used ShellExecuteEx
to run the .exe file but it is not taking the arguments. Please help where did i went wrong. I am posting my code below.
void StartProgram() {
SHELLEXECUTEINFO lpExecInfo;
lpExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
lpExecInfo.lpFile = L"F:\\EXEFolder\\RunMe.exe"; // Path to the .exe
lpExecInfo.fMask = SEE_MASK_DOENVSUBST | SEE_MASK_NOCLOSEPROCESS;
lpExecInfo.hwnd = NULL;
lpExecInfo.lpVerb = L"open"; // to open program
lpExecInfo.lpParameters = L"D:/input.csv" "F:/output.csv;"; //Arguments to be passed to .exe
lpExecInfo.lpDirectory = NULL;
lpExecInfo.nShow = SW_SHOW;
lpExecInfo.hInstApp = (HINSTANCE)SE_ERR_DDEFAIL;
ShellExecuteEx(&lpExecInfo);
//wait until a file is finished printing
if (lpExecInfo.hProcess != NULL)
{
::WaitForSingleObject(lpExecInfo.hProcess, INFINITE);
::CloseHandle(lpExecInfo.hProcess);
}
}