I am trying to implement CreateProcessW within a dll so that the user can launch an application in a separate process.
For starters I am hardcoding the commands in the code until I figure it out..
I've got
STARTUPINFO si = {sizeof(STARTUPINFO), 0};
si.cb = sizeof(si);
PROCESS_INFORMATION pi = {0};
LPCTSTR AppName=L"c:\\utilities\\depends.exe";
LPTSTR Command = L"c:\\utilities\\tee.exe";
if (CreateProcessW(AppName, Command, 0, 0, 0, CREATE_DEFAULT_ERROR_MODE, 0, 0, &si, &pi)) {
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
return GX_RESULT_OK;
} else {
.. show error msg
}
This will launch Depends but won't open Tee.exe. There's no error, it just ignores the command line parameter. The parameters are correct and I can run it at the run prompt and it works fine. If I leave AppName blank and specify Depends.exe as the Command parameter it also works, but if I specify
LPTSTR Command = L"c:\\utilities\\depends.exe c:\\utilities\\tee.exe";
I get Error 3: "The system cannot find the path specified".
Also, by specifying the lpCurrentDirectory parameter it is likewise ignored.