好简单阿~`
那些都是由系统处理的
你只是需要执行他就好了~`引用 ShellAPI 单元~
然后 用  ShellExecute 执行这个文件;格式: ShellExecute(Handle, nil, temp.doc, nil, nil, SW_NORMAL);

解决方案 »

  1.   

    uses shellapiShellExecute(Handle, 'open', PChar('c:\test\readme.txt'),nil, nil, SW_SHOW);
      

  2.   

    有一点补充一下(temp.doc)用单引号引起来~~~
      

  3.   

    以下是我收集的: //执行ipconfig /all 输出到c:\aa.txt
     winexec(pchar('command.com /c ipconfig /all >c:\aa.txt'),sw_hide);WinExec(pchar('command /c type aaa.txt'), SW_NORMAL); //执行完后立即关闭DOS窗口或
    WinExec(pchar('command /k type aaa.txt'), SW_NORMAL); //执行完后不关闭DOS窗口
       启动外部程序我们可以使用函数Winexec、ShellExecute和ShellExecuteEx。我推荐大家使用函数ShellExecute,因为它既灵活,又简单。看看下面的例子,用法就清楚了:*: 启动一个程序ShellExecute(Handle,'open',PChar('c:\test\app.exe'),nil,nil,SW_SHOW);Winexec(pchar(edit1.text),sw_restore);* 启动记事本 (因为记事本在系统路径下,所以不必写完整的路径名了):ShellExecute(Handle, 'open', PChar('notepad'),nil, nil, SW_SHOW);* 启动记事本并加载一个纯文本文件:ShellExecute(Handle, 'open', PChar('notepad'),PChar('c:\test\readme.txt', nil, SW_SHOW);* 使用记事本打开一个纯文本文件 (请确定*.txt文件被关联到记事本):ShellExecute(Handle, 'open', PChar('c:\test\readme.txt'),nil, nil, SW_SHOW);* 使用默认浏览器打开网址:ShellExecute(Handle, 'open', PChar('http://www.festra.com/'),nil, nil, SW_SHOW);* 打印一个文件:ShellExecute(Handle, 'print', PChar('c:\test\readme.txt'),nil, nil, SW_SHOW);* 用Windows Explorer打开一个文件夹:ShellExecute(Handle, 'explore', PChar('c:\windows)',nil, nil, SW_SHOW);* 运行一个DOS命令并立即返回:ShellExecute(Handle, 'open', PChar('command.com'), PChar('/c copy file1.txt file2.txt'), nil, SW_SHOW);* 运行一个DOS命令并保持DOS窗口打开 ("stay in DOS"):ShellExecute(Handle, 'open', PChar('command.com'), PChar('/k dir'), nil, SW_SHOW);--调用外部EXE文件--uses WinProcs; 

    begin 
    Winexec(pchar(edit1.text),sw_restore);

    end.
      

  4.   

    还有一点啊:如果系统没有装相应的工具,就不能够打开了啊!!!!    我要的是象Windows一样的有一个打开方式窗口啊
      

  5.   

    下面的涵數可以解決你的問題 :
    Function OpenFile(filename:string):integer;
    begin
      ShellExecute(0, 'open', PChar(filename),nil, nil, SW_SHOW);//用關聯的程序打開文件
      Result :=GetLastError;
      if Result=1155 then //如果文件沒有關聯程序,則用windows的OpenWith
      begin
       ShellExecute(0,nil,Pchar('RunDll32.exe'),
           Pchar('SHELL32.DLL,OpenAs_RunDLL '+filename),nil, SW_SHOWNORMAL) ;
       Result := GetLastError ;
      end;
    end;
      

  6.   

    下面的涵數可以解決你的問題 :
    Function OpenFile(filename:string):integer;
    begin
      ShellExecute(0, 'open', PChar(filename),nil, nil, SW_SHOW);//用關聯的程序打開文件
      Result :=GetLastError;
      if Result=1155 then //如果文件沒有關聯程序,則用windows的OpenWith
      begin
       ShellExecute(0,nil,Pchar('RunDll32.exe'),
           Pchar('SHELL32.DLL,OpenAs_RunDLL '+filename),nil, SW_SHOWNORMAL) ;
       Result := GetLastError ;
      end;
    end;