Ver Mensaje Individual
  #3  
Antiguo 20-10-2012
Avatar de HombreGordo
HombreGordo HombreGordo is offline
Miembro
 
Registrado: jul 2008
Posts: 41
Reputación: 0
HombreGordo Va por buen camino
Smile Así fue como lo resolví

Ah bueno tu solución también es válida, mira lo que conseguí en internet para ayudarme también, un TIdHTTP de Indy:
Código Delphi [-]
internetFile := 'http://api.twitter.com/1/statuses/user_timeline.xml?include_entities=false&include_rts=true&screen_name=twitterapi&count=15';
  localFileName := 'user_timeline.xml';
  try
  //GetInetFile( internetFile, localFilename);
  //URLDownloadToFile( nil, PWideChar(internetFile), PWideChar(localFilename), 0, nil);
  Http := TIdHTTP.Create(nil);
  try
    MS := TMemoryStream.Create;
    try
      Http.OnWork:= HttpWork;

      Http.Get(internetFile, MS);
      MS.SaveToFile(localFileName);

    finally
      MS.Free;
    end;
  finally
    Http.Free;
  end;
Y Http.Work es:
Código Delphi [-]
private
    { Private declarations }
    procedure HttpWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);

...

procedure TFormMain.HttpWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);
var
  Http: TIdHTTP;
  ContentLength: Int64;
  Percent: Integer;
begin
  Http := TIdHTTP(ASender);
  ContentLength := Http.Response.ContentLength;

  if (Pos('chunked', LowerCase(Http.Response.TransferEncoding)) = 0) and
     (ContentLength > 0) then
  begin
    Percent := 100*AWorkCount div ContentLength;

    //MemoOutput.Lines.Add(IntToStr(Percent));
  end;
end;
Vean que también usé URLDownloadToFile de URLMon, pero no lo probé mucho realmente. Tal vez sirve mejor que este parapeto que tengo allí jajaja Gracias a todos por ayudarme :-)
__________________
Aprendiz de Embarcadero RAD Studio...
Responder Con Cita