delphi 链接 文件比如链接电子文档等等 就在delphi编写的程序去打开其他文件!

在delphi里面, 比如一个标签 单击 事件 写链接到其他文件TXT。等等

就是打开其他文件, 可以吗???
谢谢

当然可以
比如要打开软件安装目录下的“123.chm”文件,就用如下代码:
var
path:string;
begin
path:=ExtractFilePath(application.exename);
Application.HelpFile := path+‘123.chm';
ShellExecute(0, 'open', PChar(Application.HelpFile), nil, nil, SW_SHOW);

end;

注意:要 uses shellapi
温馨提示:答案为网友推荐,仅供参考
第1个回答  2009-08-08
楼上的麻烦。直接这一句:
winexec(pchar('cmd /c start '+filename),sw_hide);
//好了,把这句话放到label的click事件中就行了。。记得把filename换成你的文件名。文件名中不能出现空格
比如存在 c:\1.txt,那就是 winexec(pchar('cmd /c start '+'c:\1.txt'),sw_hide);
filename也可以是个网页地址。
相似回答