CreateProcess() returns false when the commandline contains a path.I don't understand why.
Here I simplified the operation:
function ExecProcess(path:string):boolean;
var StartupInfo:TstartupInfo;
ProcInfo:TProcessInformation;
begin
FillChar( StartupInfo, SizeOf( TStartupInfo ), 0 );
StartupInfo.cb := SizeOf( TStartupInfo );
Result:= CreateProcess(nil, PChar(path), Nil, Nil, False, 0, Nil, PChar(ExtractFilePath(path)),StartupInfo,ProcInfo);
end;
begin
ExecProcess(ParamStr(0) + ExtractFilePath(ParamStr(0)));
end.
Result is false.
How do I include path in commandline?