RT

解决方案 »

  1.   

    function FtpCommandDirList(hFtpSession: HINTERNET): String;
    var
      data_handle: HINTERNET;
      bytes_read: DWORD;
      text_buffer: PChar;
      buffer_size: DWORD;
    begin
      result := '';
      data_handle := nil;
      if not FtpCommand(m_hFtpSession,true,FTP_TRANSFER_TYPE_ASCII,
        PChar('NLST'),0,@data_handle) then
      begin
        SetErrorCode(GetLastError());
        Application.MessageBox(PChar(SysErrorMessage(GetLastError())),'');
        exit;
      end;
      // Read the data.
      buffer_size := 1000;    // Arbitrary value.
      GetMem(text_buffer,buffer_size);
      bytes_read := 1;
      while bytes_read > 0 do
      begin
        InternetReadFile(data_handle,text_buffer,buffer_size, bytes_read);
        result := result + System.Copy(text_buffer,0,bytes_read);
      end;
      InternetCloseHandle(data_handle);
      FreeMem(text_buffer,buffer_size);
    end;
      

  2.   

    我的wininet文件的FtpCommand函数只有5个参数,,是不是要重新定义这个函数了。
      

  3.   

    上面可以调出来了,,可是命令换成 GET 就不行了。。
    谁有用这个下载文件的实例了
      

  4.   

    查MSDN吧。http://msdn.microsoft.com/en-us/library/aa384133(VS.85).aspx
      

  5.   

    不知道怎么回事,好像FTPCOMMAND和FTPopenfile同时用了没效果做不到续传。。