Club Delphi  
    FTP   CCD     Buscar   Trucos   Trabajo   Foros

Retroceder   Foros Club Delphi > Principal > Varios
Registrarse FAQ Miembros Calendario Guía de estilo Temas de Hoy

Grupo de Teaming del ClubDelphi

Respuesta
 
Herramientas Buscar en Tema Desplegado
  #1  
Antiguo 15-04-2013
wolfran_hack wolfran_hack is offline
Miembro
 
Registrado: abr 2013
Posts: 97
Poder: 12
wolfran_hack Va por buen camino
Problema a descargar actualización mediante WinInet

CODE:

Código Delphi [-]
function DescargarArchivo( sURL, sArchivoLocal: String ): boolean;
const BufferSize = 1024;
var
  hSession, hURL: HInternet;
  Buffer: array[1..BufferSize] of Byte;
  LongitudBuffer: DWORD;
  F: File;
  sMiPrograma: String;
begin
  sMiPrograma := ExtractFileName( Application.ExeName );
  hSession := InternetOpen( PChar( sMiPrograma ), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0 );

  try
    hURL := InternetOpenURL( hSession, PChar( sURL ), nil, 0, 0, 0 );

    try
      AssignFile( F, sArchivoLocal );
      Rewrite( F, 1 );

      repeat
        InternetReadFile( hURL, @Buffer, SizeOf( Buffer ), LongitudBuffer );
        BlockWrite( F, Buffer, LongitudBuffer ); //ERROR AQUI.
      until LongitudBuffer = 0;

      CloseFile( F );
      Result := True;
    finally
      InternetCloseHandle( hURL );
    end
  finally
    InternetCloseHandle( hSession );
  end
end;

Código Delphi [-]
procedure Form1.Button1Click(Sender: TObject);
begin
  DescargarArchivo( 'http:\\site.com\dni.csv', 'C:\dni.csv' );
end;

El archivo pesa 20Kb y me tirar error en el Buffer señalando esa linea y el texto:

Cita:
Project DNI.exe raised exception class EInOutError with message 'I/O error 1784'. Process stopped. Use Step or Run to continue.
Alguna idea?
Responder Con Cita
  #2  
Antiguo 15-04-2013
Avatar de olbeup
olbeup olbeup is offline
Miembro
 
Registrado: jul 2005
Ubicación: Santiago de la Ribera (España)
Posts: 685
Poder: 19
olbeup Va camino a la fama
Hola wolfran_hack

Creo que la línea ésta está mal:
Código Delphi [-]
InternetOpen( PChar( sMiPrograma ), INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0 );
Usa este otro:
Código Delphi [-]
InternetOpen('agent', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0 );

Un saludo
__________________
Al hacer una consulta SQL, haz que los demás te entiendan y disfruten de ella, será tú reflejo de tú saber.
Responder Con Cita
Respuesta



Normas de Publicación
no Puedes crear nuevos temas
no Puedes responder a temas
no Puedes adjuntar archivos
no Puedes editar tus mensajes

El código vB está habilitado
Las caritas están habilitado
Código [IMG] está habilitado
Código HTML está deshabilitado
Saltar a Foro

Temas Similares
Tema Autor Foro Respuestas Último mensaje
Error al descargar actualizacion de mi aplicacion sitrico Internet 2 12-07-2010 23:15:14
Descargar archivos mediante un formulario pampitasnowman PHP 17 15-05-2007 16:39:04
ftp problema al descargar ficheros Trisckel Internet 1 04-04-2007 10:32:05
actualizacion mediante ftp emenchi34 Internet 5 04-12-2006 19:00:34
Descargar archivos de directorio protegido mediante apache chux PHP 0 25-09-2006 12:59:43


La franja horaria es GMT +2. Ahora son las 12:17:58.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi
Copyright 1996-2007 Club Delphi