应该这样写:
var
DoExec:String;
PDoExec:Array [0..255] of char;
begin
doExec:=ExtractFilePath(Application.ExeName)+'\a\a.exe';
StrpCopy(PDoExec,Doexec);
WinExec(PDoExec,1);
end;

解决方案 »

  1.   

    我用的一个函数:function ExecuteFile(const FileName, Params, DefaultDir: string;
      ShowCmd: Integer): THandle;
    var
      zFileName, zParams, zDir: array[0..79] of Char;
    begin
      Result := ShellExecute(Application.MainForm.Handle, nil,
        StrPCopy(zFileName, FileName), StrPCopy(zParams, Params),
        StrPCopy(zDir, DefaultDir), ShowCmd);
    end;运行外部程序计算器:
      exepath:= ExtractFilePath(application.ExeName);
      ExecuteFile('Calc.exe','',exepath,SW_Show);
    运行日期设置:
      if LMDSysInfo1.Platform='Windows 95' then
      ExecuteFile(lmdsysinfo1.WinPath+'\control.exe','timedate.cpl',lmdsysinfo1.WinPath,SW_Show) else
      ExecuteFile(lmdsysinfo1.WinsysPath+'\control.exe','timedate.cpl',lmdsysinfo1.WinPath,SW_Show);
      

  2.   

    利用Pchar()将string类型转换一下即可.
      

  3.   

    对于常量字符串,DELPHI能够根据需要自动转换成PChar或String类型,但是如果你在字符串操作的过程中出现了STRING类型变量,那么处理之后的东西就是STRING类型了,具体你可以看一下M.C的《DELPHI4从入门到精通》
      

  4.   

    WinExec已经不再推荐使用了,最好使用CreateProcess。当然,为了解决类型不匹配,可以简单地使用PChar()来转换。
      

  5.   

    fstao, 这个问题早已解决, 希望你能把分数分掉.
    也可以让我们少一个带解决的问题!!!