I am trying to have a C++ program call an already made C# program to run in the background.
STARTUPINFO info = {sizeof(info)};
PROCESS_INFORMATION processinfo;
DWORD error1 = GetLastError();
bool x = ::CreateProcess((LPCWSTR)"C:\Convert_Shrink.exe", GetCommandLine(), NULL, NULL, false, 0,NULL,NULL, &info, &processinfo);
DWORD error = GetLastError();
error1 is 0 before CreateProcess
error is 2 after CreateProcess
error 2:
ERROR_FILE_NOT_FOUND 2 (0x2) The system cannot find the file specified.
I’ve changed it to C:\ \ incase they were checking for escape sequences but I still get error 2 and I’m not sure why.
You can:
Use
CreateProcessAto match your ANSI file path:* Provide a file path which matches the string format required by your Unicode settings:
or
Use
CreateProcessWso you can pass a Unicode filepath (supports extended characters):(as @dolphy noted, the argument has to be a writable string)
Provide a file path which matches the string format required by your Unicode settings:
or
Use
CreateProcessWso you can pass a Unicode filepath (supports extended characters):