FillChar(StartupInfo,SizeOf(StartupInfo),0);
StartupInfo.cb := SizeOf(StartupInfo);
FillChar(ClRunInf,SizeOf(ClRunInf),0);
sAppFileName := '"E:\中文\中文.exe"';
sCommandLine := sAppFileName + ' ' + (sParam1) + ' ' + sParam2;
//听说 lpCommandLine 会被写...
Move(sCommandLine[1],szCommandLine, Length(sCommandLine));
szCommandLine[Length(sCommandLine) + 1] := #0;
if CreateProcess(nil,//PChar(sAppFileName), //lpApplicationName,
@szCommandLine, //lpCommandLine, "E:\中文\中文.exe" sParam1 sParam2 //双引号 加不加好象都一样
nil, //lpProcessAttributes,
nil, //lpThreadAttributes,
False, //bInheritHandles,
0,//Create_SUSPENDED, //dwCreationFlags,Create_SUSPENDED
nil, //lpEnvironment,
PChar(sMirPath), //lpCurrentDirectory,
StartupInfo, //lpStartupInfo,
ClRunInf)then begin //lpProcessInformation //Result:=GetLastError();
end else begin
//直接双击 E:\中文\中文.exe 是可以跑的
//在有些的机器上跑不起来 本机能跑
OutMsg('失败 2:' + SysErrorMessage(GetLastError));//%1 不是有效的 Win32 应用程序。
end;
环境未说清楚,引得大家一通猜测。
CreateProcess 用的exe是动态释放的。
因为是释放出EXE 就 CreateProcess
肯定是
杀毒还在检测EXE文件 检测前杀毒会先锁定文件为不可读
谢谢大家
结贴