我想程序启动后,点击相应的按钮,从指定的服务器上通过HTTP下载一系列WAV文件下来,应该用什么方法呢,谢谢大家!

解决方案 »

  1.   

    /******************************************/1.  建立一个文本文件.
    2.  输入以下内容:
    [InternetShortcut]
    URL=在这儿写上你的URL
    3.  保存文件.
    4.  把文件扩展名修改为.url
    5.  然后, ... 比如把文件放在"快捷启动栏目"上./*******************************************/
    原理:
    如果你使用Win2K的话, 到D:\Documents and Settings\Administrator\Favorites 下面看一下
    /******************************************/
      

  2.   

    function TForm1.Downloadfile(SourceFile, DestFile: string): Boolean;
    begin
      try
        Result :=UrlDownloadToFile(nil,Pchar(SourceFile),Pchar(DestFile),0,nil)=0;
      except
        Result :=false;
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
    // URL Location
      SourceFile := 'http://www.google.com/intl/de/images/home_title.gif';
      // Where to save the file
      DestFile := 'c:\temp\google-image.gif';
      if Downloadfile(sourcefile,destfile) then
      begin
        ShowMessage('Download succesful!');
       // Show downloaded image in your browser
        ShellExecute(Application.Handle,PChar('open'),PChar(DestFile),PChar(''),nil,SW_NORMAL)
      end
      else
        ShowMessage('Error while downloading ' + SourceFile);end;