请帮忙看看这D7的代码在XE4里该怎样改法,该如何处理

请帮忙看看这D7的代码在XE4里该怎样改法
本帖最后由 lightdc4 于 2013-09-13 17:41:05 编辑
const
vfilename : string = 'D:\0.exe'

  begin
    WinExec(pAnsichar(vFilename),4);
    application.Terminate;
  end;

用shellexecute也是一样,没反应。

我在D7上运行成功打开了0这个应用程序和关上了现在的程序,但在XE4上就是不打开0这个应该程序而自动关上了。
xe4 delphi7 delphi xe4 打开外部程序

------解决方案--------------------
用《windows核心编程》中建议的用法,createprocess

请帮忙看看这D7的代码在XE4里该怎样改法,该如何处理

const
 path = 'c:\windows\system32\calc.exe';
var
 si:STARTUPINFOW;
 pi:PROCESS_INFORMATION;
begin
  ZeroMemory(@si, SizeOf(si));
  ZeroMemory(@Pi,SizeOf(pi));
  si.cb :=SizeOf(si);

  if CreateProcessW(path,'',nil,nil,False,0,nil,nil,si,pi) then
   begin
     CloseHandle(pi.hProcess);
     CloseHandle(pi.hThread);
   end;