Reputation: 1
I'm try to run program with this code:
PROCESS_INFORMATION ProcInfo = { 0 };
STARTUPINFO StartInfo = { 0 };
StartInfo.cb = sizeof(StartInfo);
if (!::CreateProcessW(NULL, (LPWSTR)wszPathToFile, NULL, NULL, FALSE, DETACHED_PROCESS, NULL, NULL, &StartInfo, &ProcInfo)) {
return GetLastError();
}
But I get error message: The system cannot find the path specified. wszPathToFile - path to file (example: "C:\test\test.exe /retest"). Folder "test" is hidden How to fix it?
Upvotes: 0
Views: 114
Reputation: 613491
That the folder is hidden is not relevant. That has no impact here.
As discussed in the comments, the fact that you are casting the lpCommandLine
argument indicates that szPathToFile
is not the correct type. It must be a pointer to a modifiable array of wide characters. If it was then you could omit the cast and the compiler would accept szPathToFile
directly.
Most likely szPathToFile
is actually a pointer to an array of ANSI encoded 8 bit char
.
Upvotes: 1