调用外部程序exe请问得用什么函数或怎么写,谢谢各位帮忙,在线等待。

解决方案 »

  1.   

    uses ShellAPI;ShellExecute(0, 'open', 'notepad.exe', nil, nil, SW_SHOW);
      

  2.   

    uses shellapi
    ShellExecute(Application.Handle,
                   'Open',
                   'C:\Windows\Rundll32.exe',
                   'Shell32.dll,SHFormatDrive',
                   'C:\Windows',
                   SW_SHOWNORMAL);或者
    WinExec('*.exe', WM_SHOW); 
    或者创建进程
    CreateProcess(PChar('c:\program files\microsoft office\office\winword.exe'),
          nil,nil,nil,true,DETACHED_PROCESS,nil,nil,st,pp);关闭进程
      ppp:=OpenProcess(PROCESS_ALL_ACCESS, FALSE,pp.dwProcessId );
      TerminateProcess(ppp,0);}
      

  3.   

    一楼的办法,或者用
    winexec('c:\1.exe',sw_show);
      

  4.   

    winexec
    shellexecute
    都可以
    只不过winexec是Obsolete Functions