Page 1 of 1

error on download

Posted: Mon Oct 05, 2020 4:55 pm
by Silvio.Falconi
To download a file from Internet I used this function URLDownloadToFileA

Now the file not is downloaded

I'm using Windows Seven Home Premium or Windows 10 Home

If I test the url where I must download the file it run ok , I can download the file but from fivrewin I have problems what's happened ?

the test

Code: Select all

#include "FiveWin.ch"
#include "xBrowse.ch"
#include "constant.ch"

REQUEST DBFCDX
REQUEST DBFFPT
EXTERNAL ORDKEYNO,ORDKEYCOUNT,ORDCREATE,ORDKEYGOTO
//---------------------------------------------------------------//


#define URL_LOTTO "https://www.lottomatica.it/STORICO_ESTRAZIONI_LOTTO/storico.zip"

Function test()
Local cPath:=".\dat\"
DescargFichDesdeUrl(cPath)
return nil


Static Function DescargFichDesdeUrl(cPath)
   local cZipFile := cPath+"storico_"+DtoS(Date())+".zip"
   local cUrl  := URL_LOTTO

    DELETEURLCACHEENTRY( cUrl )
    ? cZipFile
    URLDOWNLOADTOFILE( 0, cUrl, cZipFile )

RETURN NIL

DLL STATIC FUNCTION DELETEURLCACHEENTRY( cUrl AS LPSTR ) AS BOOL;
    PASCAL FROM "DeleteUrlCacheEntryA" LIB "wininet.dll"

DLL FUNCTION URLDOWNLOADTOFILE( pCaller AS LONG, cUrl AS LPSTR, cFileName AS LPSTR, nReserved AS DWORD, nFnCB AS LONG ) AS LONG;
    PASCAL FROM "URLDownloadToFileA" LIB "urlmon.dll"
I allready check the tls option

Image

trying this evening on windows seven premium give me this error on compilation

Code: Select all

Progetto: test, Ambiente: bcc7Harbor:
[1]:Harbour.Exe test.prg  /m /n0 /gc1 /es2 /a /iC:\Work\fwh\include /iC:\work\HARBOUR\Include /jI18n\Main.hil /iinclude;c:\work\fwh\include;C:\work\HARBOUR\include /oObj\test.c
Harbour 3.2.0dev (r1904111533)
Copyright (c) 1999-2019, https://harbour.github.io/
Compiling 'test.prg'...
Lines 4980, Functions/Procedures 2
Generating C source output to 'Obj\test.c'... Done.
[1]:Bcc32.Exe -M -c -DHB_OS_WIN_32 -DHB_FM_STATISTICS_OFF -DHB_NO_DEFAULT_API_MACROS -DHB_NO_DEFAULT_STACK_MACROS -IC:\Work\fwh\include -IC:\work\bcc7\Include\windows\sdk\;C:\work\HARBOUR\Include  -nObj Obj\test.c
Embarcadero C++ 7.30 for Win32 Copyright (c) 1993-2017 Embarcadero Technologies, Inc.
Obj\test.c:
[1]:iLink32.Exe -Gn -aa -Tpe -s -v @test.bcl
Turbo Incremental Link 6.80 Copyright (c) 1997-2017 Embarcadero Technologies, Inc.
Error: Unresolved external 'URLDownloadToFileA' referenced from C:\WORK\ERRORI\DOWNLOAD\OBJ\TEST.OBJ
Error: Unable to perform link
 

Re: error on download

Posted: Mon Oct 05, 2020 6:21 pm
by FranciscoA
Silvio.
Intenta activando -> Usa SSL 3.0

Saludos

Re: error on download

Posted: Mon Oct 05, 2020 8:16 pm
by karinha
Simples...

Code: Select all

#Include "FiveWin.ch"

#Define URL_LOTTO "https://www.lottomatica.it/STORICO_ESTRAZIONI_LOTTO/storico.zip"

FUNCTION Silvio_DownLoad()

   LOCAL cUrl := ALLTRIM( URL_LOTTO )

   Download_Silvio( cUrl )

RETURN NIL

FUNCTION Download_Silvio( cUrl )

   cUrl := IF( "@" $ cUrl, "mailto:" + cUrl, cUrl )

   // ? cUrl

   IF Empty( cUrl )

      MsgInfo( "Introduza Uma URL Correta", "Atencion" )

   ELSE

      CURSORWAIT()

      IF IsWinNT() .OR. isWin2000() // XP/2000/NT

         WinExec( "rundll32.exe url.dll, FileProtocolHandler " + cUrl, 0 )

      ELSE

         WinExec( "Start " + cUrl, 0 )

      ENDIF

      CURSORARROW()

   ENDIF

RETURN NIL

// fin - By: kapiabafwh@gmail.com
 
Regards, saludos.

Re: error on download

Posted: Tue Oct 06, 2020 9:17 am
by Silvio.Falconi
karinha wrote:Simples...

Code: Select all

#Include "FiveWin.ch"

#Define URL_LOTTO "https://www.lottomatica.it/STORICO_ESTRAZIONI_LOTTO/storico.zip"

FUNCTION Silvio_DownLoad()

   LOCAL cUrl := ALLTRIM( URL_LOTTO )

   Download_Silvio( cUrl )

RETURN NIL

FUNCTION Download_Silvio( cUrl )

   cUrl := IF( "@" $ cUrl, "mailto:" + cUrl, cUrl )

   // ? cUrl

   IF Empty( cUrl )

      MsgInfo( "Introduza Uma URL Correta", "Atencion" )

   ELSE

      CURSORWAIT()

      IF IsWinNT() .OR. isWin2000() // XP/2000/NT

         WinExec( "rundll32.exe url.dll, FileProtocolHandler " + cUrl, 0 )

      ELSE

         WinExec( "Start " + cUrl, 0 )

      ENDIF

      CURSORARROW()

   ENDIF

RETURN NIL

// fin - By: kapiabafwh@gmail.com
 
Regards, saludos.
yes of cource this run ok
BUT I wish not show the link where I download it

Re: error on download

Posted: Tue Oct 06, 2020 11:03 am
by karinha
CALLDLL()? No funciona?

Re: error on download

Posted: Tue Oct 06, 2020 11:12 am
by karinha
Intenta asi con Harbour, no uso. No puedo ayudar.

Code: Select all

#include "FiveWin.ch"

FUNCTION Main()

   nHandleDLL := LoadLib32( "UrlMon.dll" )

   nStatus := hb_dynCall( { "URLDownloadToFileA", nHandleDLL,HB_DYN_CALLCONV_STDCALL},0,"http://www.bcb.gov.br/Ftp/pstaw10/leiame.txt","C:\leiame.txt",0,0)

   hb_LibFree( nHandleDLL )

RETURN NIL
 

Re: error on download

Posted: Tue Oct 06, 2020 12:37 pm
by karinha

Re: error on download

Posted: Wed Oct 07, 2020 9:42 am
by Silvio.Falconi
NOW PERHAPS i RESOLVED .
on Windows Seven of work run ok
on Windows seven Home not run
on Windows 10 tablet I must also tested