URL Download to File

Other General Resources like icon sets, sound files etc.,

Moderator: Rathinagiri

Post Reply
User avatar
bpd2000
Posts: 924
Joined: Sat Sep 10, 2011 4:07 am
Location: India
Has thanked: 89 times
Been thanked: 27 times

URL Download to File

Post by bpd2000 » Sat Jun 17, 2017 9:33 am

Working example of URLdownloadto file
It finished after expert help from KDJ

Code: Select all

/*
From bpd2000
Expert help from KDJ
*/


#include "hmg.ch"

function Main()

   local Down_Result, cURL := "http://www.hmgforum.com/download/file.php?id=8044"

   Down_Result := DOWNLOADFILE( cURL, HB_CWD() + "Down_file.ZIP" )
                         //file will be downloaded in current directory
  
  If Down_Result = 0 
        MsgStop ( "File " + cURL + hb_osnewline() + "has been downloaded!")
    Else 
        MsgStop ("File not found!")
  EndIf 


RETURN NIL

#pragma BEGINDUMP

#include "SET_COMPILE_HMG_UNICODE.ch"
#include "HMG_UNICODE.h"

#include <Windows.h>
#include <urlmon.h>
#include "hbapi.h"

HB_FUNC( DOWNLOADFILE )
{
   HRESULT hr;
        
   hr = URLDownloadToFileW( NULL, HMG_parc( 1 ), HMG_parc( 2 ), 0, NULL );
  
   hb_retnl( hr ) ;
}

#pragma ENDDUMP

Attachments
URLDownloadToFile.rar
(1.21 MiB) Downloaded 22 times
BPD
HMG Convert Dream into Reality

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests