最近在做程序时遇到一个问题,已简化如下:做了一个窗体Form1,窗体上有一个按钮Button1。现在想达到这样的效果:单击该按钮后,实现打开(即双击)d:\test\test.exe的效果(该文件是我为了描述问题假想的一个可执行文件)。我不知这该怎么实现,也不知道怎样用简短的话描述这一问题,所以也查不到相关资料。请各位帮帮忙,谢谢了!!
想多给点分的,可惜可用分只有这些了,请各位见量。

解决方案 »

  1.   

    ShellExecute(Application.MainForm.Handle, nil, FileName, '', FilePath, SW_Show)
      

  2.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
     ShellExecute(handle, 'open', PChar('d:\test\test.exe'), nil, nil, sw_show);
    end;
      

  3.   

    记得包含ShellAPI单元,即Uses里加ShellAPI。
      

  4.   

    Uses ShellAPI;ShellExecute(handle, 'open', PChar('d:\test\test.exe'), nil, nil, sw_show);
      

  5.   

    用winexec也可以实现
    winexec(PChar('d:\test\test.exe'), SW_SHOWNORMAL);
      

  6.   

    Uses ShellAPI;ShellExecute(handle, 'open', PChar('d:\test\test.exe'), nil, nil, sw_show);
      

  7.   

    包含ShellAPI单元,即Uses里加ShellAPI。Uses ShellAPI;ShellExecute(handle, 'open', PChar('d:\test\test.exe'), nil, nil, sw_show);
      

  8.   

    winexec(PChar('d:\test\test.exe'), SW_SHOWNORMAL);
      

  9.   

    ShellExecute(handle, 'open', PChar('d:\test\test.exe'), nil, nil, sw_show);