读书人

CreateProcess 失败!%1 不是有效的 W

发布时间: 2012-02-11 09:51:35 作者: rapoo

CreateProcess 失败!%1 不是有效的 Win32 应用程序。莫名其妙啊

Delphi(Pascal) code
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;


[解决办法]
,来啊
[解决办法]
是你的中文路径问题吧,换个英文路径看看
[解决办法]
我肯定你装了360了,而且你的程序叫Project1.exe

读书人网 >.NET

热点推荐