假设我希望程序“C:\MyProgram.exe”使用两个变量的参数运行。出现的问题是 MyProgram 只接收 2 个参数,而我清楚地传递了 3 个参数。
我的代码:
SHELLEXECUTEINFO ShExecInfo = { 0 };
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO);
ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
ShExecInfo.hwnd = NULL;
ShExecInfo.lpVerb = NULL;
ShExecInfo.lpDirectory = NULL;
ShExecInfo.nShow = SW_SHOW;
ShExecInfo.hInstApp = NULL;
ShExecInfo.lpFile = T("\"C:\\MyProgram.exe\"");
ShExecInfo.lpParameters = _T("\"\"") _T(" ") + dir + file[i] + _T(" ") + dir + outputfile + _T(".TIFF");
ShellExecuteEx(&ShExecInfo);
WaitForSingleObject(ShExecInfo.hProcess, 1500);
if(GetExitCodeProcess(ShExecInfo.hProcess, &exitCode)){
MessageBox(_T("Conversion ") + file[i] + _T(" unsuccesful."), _T("TEST!"), MB_OK);
succes = 0;
}
因为互联网上没有太多关于 ShellExecuteEx 可变参数的信息,所以我找不到合适的解释。
你们中有人知道如何解决这个问题吗?提前致谢!