I am using ShellExecuteEx to run an external program which works fine on my end. Various people who have tried it are getting very strange errors though. I read a topic on MSDN forums that discussed ShellExecuteEx depending on settings a user may have, but I didn't grasp much from it. What variables are there that may be causing the problem? The problem is that Windows pops up an error saying the target program can't be found, as if the program was not in the directory. It passes a check initially with GetFileAttributes for existance in the first place though, so it's very confusing to me.......
So I call it, wait til it finishes and then proceed. It works fine for me, but other people don't have success with it reporting an error that Windows can't find prg.exe, despite being in the same directory...Code:SHELLEXECUTEINFO ShExecInfo = {0}; ShExecInfo.cbSize = sizeof(SHELLEXECUTEINFO); ShExecInfo.fMask = SEE_MASK_NOCLOSEPROCESS; ShExecInfo.hwnd = NULL; ShExecInfo.lpVerb = "open"; ShExecInfo.lpFile = "prg.exe"; //exe path ShExecInfo.lpParameters = cmdline; //crafted command line ShExecInfo.lpDirectory = NULL; ShExecInfo.nShow = SW_HIDE; ShExecInfo.hInstApp = NULL; ShellExecuteEx(&ShExecInfo); //wait until it completes WaitForSingleObject(ShExecInfo.hProcess,INFINITE);