winexec()在D7中编译没有任何有关问题,可是在XE中运行就提示异常

winexec()在D7中编译没有任何问题,可是在XE中运行就提示错误

procedure TMDIChild.viewastext1Click(Sender: TObject);
var
  currentdir:string;
  s:string;
begin
  currentdir:=extractfilepath(paramstr(0));
  if trim(srec.path)<>'' then s:='notepad.exe  '+Srec.path+Srec.name+'.ini'
  else s:='notepad.exe  '+currentdir+Srec.name+'.ini';

  winexec(pchar(s),1);
end;



winexec()在D7中编译没有任何有关问题,可是在XE中运行就提示异常


请问是何缘故啊?
winexec Delphi

------解决方案--------------------
改为:winexec(PANSIChar(s),1);
------解决方案--------------------
winexec的第一个参数是LPCSTR类型的也就是char *也就是PAnsiChar,你在xe4里面给他传宽字节字符串怎么行

另外winexec主要是为16位系统兼容的,后续不在更新了,建议你改用shellexecute或createprocess