在使用winexec 时首先在USEs 单元中加入ExtCtrls;<br> 二是winexec 中第一个参数是可执行的文件的绝对路径再写上要打开文件, 引起来.<br> <br> winexec('C:/Program Files/Accessories/WORDPAD.EXE abc.txt',1);<br><br>如:interface<br><br>uses<br> Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,<br> StdCtrls, Buttons, ExtCtrls;<br><br>type<br> TForm_brow_file = class(TForm)<br> Memo1: TMemo;<br> OpenDialog1: TOpenDialog;<br> SpeedButton1: TSpeedButton;<br> SpeedButton3: TSpeedButton;<br> Button1: TButton;<br> procedure SpeedButton3Click(Sender: TObject);<br> procedure SpeedButton1Click(Sender: TObject);<br> procedure Button1Click(Sender: TObject);<br> private<br> { Private declarations }<br> public<br> { Public declarations }<br> end;<br><br>var<br> Form_brow_file: TForm_brow_file;<br><br>implementation<br><br>{$R *.DFM}<br><br>procedure TForm_brow_file.SpeedButton3Click(Sender: TObject);<br>begin<br> close ;<br>end;<br><br>procedure TForm_brow_file.SpeedButton1Click(Sender: TObject);<br>begin<br> winexec('C:/Program Files/Accessories/WORDPAD.EXE abc.txt' ,1);<br>end;<br>