ShellExecute(handle,'open',Pchar(help.exe),nil,nil,SW_SHOWNORMAL);

解决方案 »

  1.   

    ShellExecute(handle,'open',Pchar(help.exe),nil,nil,SW_SHOWNORMAL);
      

  2.   

    winexec or shellexecute
    winexec可以打开exe文件
    shellexecute可以打开各种类型的文件(只要windows下能运行)
      

  3.   

    基本同意yopeng(小混混) 的方法,但是因为shellexecute是api函数,所以需要先在uses中加入 "shellapi" (不包括引号)ShellExecute(form1.handle,'open','EXE的路径和文件名'nil,nil,SW_SHOWNORMAL);
      

  4.   

    ShellExecute(form1.handle,'open','EXE的路径和文件名'nil,nil,SW_SHOWNORMAL);
      

  5.   

    谢谢各位,其中的handle是什么意思??
      

  6.   

    程序句柄,用于标识程序,实际上是个integer数据
      

  7.   

    ShellExecute和winexec都可以,,,具体在帮助里面查!
      

  8.   

    handle是句柄
    其实你不用管handle是什么意思,只要写form1.handle就可以了(form1是你那个窗口的name,如果不叫form1,那替换就可以了)
      

  9.   

    那我想OPEN的文件再我当前程序的目录下该怎么写呢???
      

  10.   

    setcurrentdirectory(pchar('exe文件路径'));
    ShellExecute(form1.handle,'open',pchar('EXE文件名'),nil,nil,SW_SHOWNORMAL);
      

  11.   

    我强烈建议大家使用使用ShellExecute而不用WinExec,为什么呢?
    因为ShellExecute可以指定路径(倒数第二个参数),比如说你
    有一个c:\temp\aa.bat,aa.bat里面是一些文件、目录的DOS命令,
    如果你用
    WinExec('c:\temp\aa.bat',SW_SHOWNORMAL),往往aa.bat执行不了。
    但是你用
    ShellExecute(form1.handle,'open',pchar
                  ('c:\temp\aa.bat'),
                   nil,
                  'aa.bat需要的目录',  //这可是关键哟
                  SW_SHOWNORMAL)
    这样就可以争取执行了!!