Club Delphi  
    Paypal   FTP   CCD     Buscar   Trucos   Trabajo   Foros

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

Colaboración Paypal con ClubDelphi

 
 
Herramientas Buscar en Tema Desplegado
  #2  
Antiguo 04-05-2016
Avatar de fredo
fredo fredo is offline
Miembro
 
Registrado: oct 2003
Ubicación: Chile, Valparaiso
Posts: 318
Poder: 23
fredo Va por buen camino
esto es para bajar por url, si quieres copiar por la red es mas facil....

Código Delphi [-]
function Download(Url: string; Archivo: string): Boolean;
var
   hFile: THandle;
   hNet: HINTERNET;
   hUrl: HINTERNET;
   Buffer: array[0..102400] of Char;
   BytesRead: DWORD;
   BytesWritten: DWORD;
begin
    Result := FALSE;
    hFile := CreateFile(PChar(Archivo), GENERIC_WRITE, 0, nil, CREATE_ALWAYS,
    FILE_ATTRIBUTE_NORMAL, 0);
    if (hFile <> INVALID_HANDLE_VALUE) then
    begin
         hNet := InternetOpen('agent', INTERNET_OPEN_TYPE_PRECONFIG, nil, nil, 0);
         if (hNet <> nil) then
         begin
              hUrl := InternetOpenUrl(hNet, PChar(Url), nil, 0,
              INTERNET_FLAG_RELOAD, 0);
              if (hUrl <> nil) then
              begin
                  while (InternetReadFile(hUrl, @Buffer, sizeof(Buffer), BytesRead)) do
                  begin
                      if (BytesRead = 0) then
                      begin
                          Result := TRUE;
                          break;
                      end;
                      if (not WriteFile(hFile, Buffer, BytesRead, BytesWritten, nil))
                      then break;
                      if (BytesRead <> BytesWritten)
                      then break;
                  end;
                  InternetCloseHandle(hUrl);
              end;
              InternetCloseHandle(hNet);
        end;
        CloseHandle(hFile);
    end;
end;
__________________
^_^

http://stna.cl
Responder Con Cita
 



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
Importar Imagenes desde un servidor Linux Pedro Nel Ortiz Gráficos 1 25-04-2011 23:45:44
Descargar un fichero sagitarius Internet 2 13-02-2008 03:35:33
Administrar servidor linux desde windows lookmydoom Linux 3 11-07-2007 17:57:58
Descargar fichero 25 Mb desde internet fmatias Internet 4 06-07-2007 17:43:59
Como hacer un shares en un Servidos Linux para que otro Servidor Linux .... FernandoFAI Linux 0 15-04-2004 09:33:07


La franja horaria es GMT +2. Ahora son las 11:08:24.


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