Może ktoś wie jak w wininet skorzystać z połączenia przez proxy.(np. host 127.0.0.1 i port 9202). Chodzi mi o pobranie listy plików z katalogu na serwerze poprzez FTP.

// wrzuć na formularz ListBox-a
uses ..., WinInet;

procedure TForm1.Button1Click(Sender: TObject);
var
  hOpen, hConnect, hFind: HINTERNET;
  w32fd: TWin32FindData;
  s: string;
begin
  ListBox1.Items.Clear;

  hOpen := InternetOpen('', 0, '', '', 0);

  if hOpen = nil then
  begin
    ShowMessage('InternetOpen failed!');
    Exit;
  end;

  hConnect := InternetConnect(
    hOpen, 'nazwa_hosta',
    21, 'nazwa_użytkownika', 'hasło',
    INTERNET_SERVICE_FTP, 0, 0
    );

  if hConnect = nil then
  begin
    ShowMessage('InternetConnect failed!');
    if hOpen <> nil then InternetCloseHandle(hOpen);
    Exit;
  end;

  try
    FillChar(w32fd, SizeOf(w32fd), 0);
    hFind := FtpFindFirstFile(hConnect, '*', w32fd, 0, 0);
    // * - file mask

    if hFind <> nil then
    try
      repeat
        s := w32fd.cFileName;
        if w32fd.dwFileAttributes and FILE_ATTRIBUTE_DIRECTORY > 0 then
          s := '[DIR] ' + s;
        ListBox1.Items.Add(s);
      until integer(InternetFindNextFile(hFind, @w32fd)) = 0;
    finally
      InternetCloseHandle(hFind);
    end;

  finally
    if hConnect <> nil then InternetCloseHandle(hConnect);
    if hOpen <> nil then InternetCloseHandle(hOpen);
  end;

end;