Thursday, 15 May 2014

c++ - Why are the ShellExecuteEx() parameters not working? -


Let me run the program with "C: \ MyProgram.exe" to run with two variable parameters. The problem that is happening is that MyProgram only receives 2 parameters, while I explicitly pass 3 parameters.

My code:

  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 ("") + dial + output file + _T (". TIFF"); ShellExecuteEx (& amp; ShExecInfo); WaitingScoreAngel Object (ShExecInfo.hProcess, 1500); If (GetExitCodeProcess (ShExecInfo.hProcess, and ExitCode)) {message box (_T ("conversion") + file [i] + _T ("unsuccesful."), _T ("test!"), MB_OK); Succes = 0; }  

Because there is not much information on variable parameters with shellEXextex on the internet, I did not find the proper explanation for this.

Do any of you know how to solve this problem? thank you in advanced!

Just a temporary object and pointer (a CTTing I think) is stored but the floating object is already When you launch the program, it is destroyed.

  auto str = _T ("\" \ "") _T ("") + dir + file [I] + _T ("") + dial + output file + _T (". TIFF "); ShExecInfo.lpParameters = str; ShellExecuteEx (& amp; ShExecInfo);  

No comments:

Post a Comment