I am trying to implement CreateProcessW in a DLL so that the user can run the application in a separate process.
For starters, I hardcode the commands in the code until I figure it out.
I have
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 will not open Tee.exe. There is no error, it just ignores the command line option. The parameters are correct, and I can run it on the command line, and it works fine. If you leave AppName empty 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 also ignored.
marcp source
share