Quoestion for Antonio

Quoestion for Antonio

Postby Jeff Barnes » Fri Oct 24, 2008 2:47 pm

Hi Antonio,

I have run into a problem and I hope you can help (there is another post on this but I wanted to start from scratch).

I am trying to do some FTP file transfers and am having problems so I went back to the basics...

I am playing with the icopyfil.prg sample and everything seems to work until I look at the file after the copy. The file size is 0KB. (I am only playing the the sending for now).

I get no errors. I have turned off the firewall.

What is really bothering me is that it works from my laptop but not my desktop. So I have to wonder, will it work when I send it to a client?

Is there anything you can think of that would cause this to go through the motions but leave me with an empty file?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Re: Quoestion for Antonio

Postby Enrico Maria Giordano » Fri Oct 24, 2008 5:31 pm

Try the following sample (with your data) and let me know:

Code: Select all  Expand view
#include "Fivewin.ch"


//
// File attributes
//

#define FILE_ATTRIBUTE_READONLY  1
#define FILE_ATTRIBUTE_HIDDEN    2
#define FILE_ATTRIBUTE_SYSTEM    4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE   32
#define FILE_ATTRIBUTE_NORMAL    128
#define FILE_ATTRIBUTE_TEMPORARY 256


//
// access types for InternetOpen()
//

#define INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
#define INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS


//
// manifests
//

#define INTERNET_INVALID_PORT_NUMBER    0           // use the protocol-specific default

#define INTERNET_DEFAULT_FTP_PORT       21          // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT    70          //    "     " gopher "
#define INTERNET_DEFAULT_HTTP_PORT      80          //    "     " HTTP   "
#define INTERNET_DEFAULT_HTTPS_PORT     443         //    "     " HTTPS  "
#define INTERNET_DEFAULT_SOCKS_PORT     1080        // default for SOCKS firewall servers.


//
// service types for InternetConnect()
//

#define INTERNET_SERVICE_FTP     1
#define INTERNET_SERVICE_GOPHER  2
#define INTERNET_SERVICE_HTTP    3


//
// flags for FTP
//

#define INTERNET_FLAG_TRANSFER_ASCII  1
#define INTERNET_FLAG_TRANSFER_BINARY 2


FUNCTION MAIN()

    LOCAL hInternet, hConnect

    hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )

    hConnect = INTERNETCONNECT( hInternet, "myftpaddress", INTERNET_INVALID_PORT_NUMBER, "myuserid", "mypassword", INTERNET_SERVICE_FTP, 0, 0 )

    ? FTPGETFILE( hConnect, "/emagsoftware.it/test/atest.prg", "atest.prg", 0, FILE_ATTRIBUTE_ARCHIVE, 0, 0 )

//    ? FTPPUTFILE( hConnect, "atest.prg", "/emagsoftware.it/test/atest.prg", 0, 0 )

    INTERNETCLOSEHANDLE( hConnect )

    INTERNETCLOSEHANDLE( hInternet )

    RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "wininet.h"
#include "hbapi.h"


HB_FUNC( INTERNETOPEN )
{
    hb_retnl( ( LONG ) InternetOpen( hb_parc( 1 ), hb_parnl( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETCLOSEHANDLE )
{
    hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}


HB_FUNC( INTERNETCONNECT )
{
    hb_retnl( ( LONG ) InternetConnect( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( INTERNET_PORT ) hb_parnl( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) ) );
}


HB_FUNC( FTPGETFILE )
{
    hb_retl( FtpGetFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parl( 4 ), hb_parnl( 5 ), hb_parnl( 6 ), hb_parnl( 7 ) ) );
}


HB_FUNC( FTPPUTFILE )
{
    hb_retl( FtpPutFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( FTPDELETEFILE )
{
    hb_retl( FtpDeleteFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPCREATEDIRECTORY )
{
    hb_retl( FtpCreateDirectory( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPREMOVEDIRECTORY )
{
    hb_retl( FtpRemoveDirectory( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}


HB_FUNC( FTPFINDFIRSTFILE )
{
    hb_retnl( ( LONG ) FtpFindFirstFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( WIN32_FIND_DATA * ) hb_parc( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETFINDNEXTFILE )
{
    hb_retl( InternetFindNextFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ) ) );
}

#pragma ENDDUMP


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8375
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Antonio Linares » Fri Oct 24, 2008 5:40 pm

Jeff,

> What is really bothering me is that it works from my laptop but not my desktop

Do they have the same Windows version and service packs installed ?

Do you have any firewall software installed on your PC ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Jeff Barnes » Fri Oct 24, 2008 5:56 pm

Antonio,

Both systems are Windows XP Pro (need to check SP levels)
Both have the same firewall (Zonealarm) but i even tried on the Desktop with ZoneAlarm shut down.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Jeff Barnes » Fri Oct 24, 2008 5:57 pm

Enrico,

I get the follow compiler errors:

┌────────────────────────────────────────────────────────────────────────────┐
│ FiveWin for xHarbour 7.11 - Nov. 2007 xHarbour development power │▄
│ (c) FiveTech, 1993-2007 for Microsoft Windows 95/98/NT/2000/ME/XP/Vista │█
└────────────────────────────────────────────────────────────────────────────┘█
  ▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
Compiling...
xHarbour Compiler build 0.99.71 (SimpLex)
Copyright 1999-2007, http://www.xharbour.org http://www.harbour-project.org/
Compiling 'ftptest.prg' and generating preprocessed output to 'ftptest.ppo'...
Lines 146, Functions/Procedures 1
Generating C source output to 'ftptest.c'...
Done.
Borland C++ 5.5.1 for Win32 Copyright (c) 1993, 2000 Borland
ftptest.c:
Turbo Incremental Link 5.00 Copyright (c) 1997, 2000 Borland
Error: Unresolved external 'InternetOpenA' referenced from C:\TEST\FTPTEST.OBJ
Error: Unresolved external 'InternetCloseHandle' referenced from C:\TEST\FTPTEST
.OBJ
Error: Unresolved external 'InternetConnectA' referenced from C:\TEST\FTPTEST.OB
J
Error: Unresolved external 'FtpGetFileA' referenced from C:\TEST\FTPTEST.OBJ
Error: Unresolved external 'FtpPutFileA' referenced from C:\TEST\FTPTEST.OBJ
Error: Unresolved external 'FtpDeleteFileA' referenced from C:\TEST\FTPTEST.OBJ
Error: Unresolved external 'FtpCreateDirectoryA' referenced from C:\TEST\FTPTEST
.OBJ
Error: Unresolved external 'FtpRemoveDirectoryA' referenced from C:\TEST\FTPTEST
.OBJ
Error: Unresolved external 'FtpFindFirstFileA' referenced from C:\TEST\FTPTEST.O
BJ
Error: Unresolved external 'InternetFindNextFileA' referenced from C:\TEST\FTPTE
ST.OBJ
* There are errors
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Antonio Linares » Fri Oct 24, 2008 6:04 pm

Jeff,

You need to link wininet.lib from Borland LIBs.
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Jeff Barnes » Fri Oct 24, 2008 8:09 pm

Enrico,

My first tests go well.

From my laptop, using your code, I can connect and send my file to both my home test FTP server and my hosted server and the file size is correct.

I will try from my desktop tonight and let you know the results.

Also, Is there any way to have a meter with these functions like what Antonio has set up in icopyfil.prg ?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Enrico Maria Giordano » Fri Oct 24, 2008 8:27 pm

Code: Select all  Expand view
#include "Fivewin.ch"


//
// File attributes
//

#define FILE_ATTRIBUTE_READONLY  1
#define FILE_ATTRIBUTE_HIDDEN    2
#define FILE_ATTRIBUTE_SYSTEM    4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE   32
#define FILE_ATTRIBUTE_NORMAL    128
#define FILE_ATTRIBUTE_TEMPORARY 256


//
// access types for InternetOpen()
//

#define INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
#define INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS


//
// manifests
//

#define INTERNET_INVALID_PORT_NUMBER    0           // use the protocol-specific default

#define INTERNET_DEFAULT_FTP_PORT       21          // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT    70          //    "     " gopher "
#define INTERNET_DEFAULT_HTTP_PORT      80          //    "     " HTTP   "
#define INTERNET_DEFAULT_HTTPS_PORT     443         //    "     " HTTPS  "
#define INTERNET_DEFAULT_SOCKS_PORT     1080        // default for SOCKS firewall servers.


//
// service types for InternetConnect()
//

#define INTERNET_SERVICE_FTP     1
#define INTERNET_SERVICE_GOPHER  2
#define INTERNET_SERVICE_HTTP    3


//
// flags for FTP
//

#define INTERNET_FLAG_TRANSFER_ASCII  1
#define INTERNET_FLAG_TRANSFER_BINARY 2


//
// file access types
//

#define GENERIC_READ  2147483648
#define GENERIC_WRITE 1073741824


FUNCTION MAIN()

    LOCAL oDlg, oPrg

    DEFINE DIALOG oDlg

    @ 2, 2 PROGRESS oPrg;
           SIZE 100, 15

    @ 3, 2 BUTTON "FTP download";
           ACTION DOWNLOAD( oPrg )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION DOWNLOAD( oPrg )

    LOCAL hInternet, hConnect, hSource, hDest, nRead

    LOCAL cData := SPACE( 1024 )

    LOCAL nPos := 0

    hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )

    hConnect = INTERNETCONNECT( hInternet, "myftpaddress", INTERNET_INVALID_PORT_NUMBER, "myuserid", "mypassword", INTERNET_SERVICE_FTP, 0, 0 )

    hSource = FTPOPENFILE( hConnect, "/emagsoftware.it/test/atest.prg", GENERIC_READ, 0, 0 )

    oPrg:SetPos( 0 )

    oPrg:SetRange( 0, FTPGETFILESIZE( hSource ) )

    hDest = FCREATE( "atest.prg" )

    WHILE .T.
        nRead = INTERNETREADFILE( hSource, @cData )

        IF nRead = -1
            ? "Download error"
            EXIT
        ENDIF

        IF nRead = 0
            ? "Download OK"
            EXIT
        ENDIF

        FWRITE( hDest, cData, nRead )

        nPos += LEN( cData )

        oPrg:SetPos( nPos )
    ENDDO

    FCLOSE( hDest )

    INTERNETCLOSEHANDLE( hSource )

    INTERNETCLOSEHANDLE( hConnect )

    INTERNETCLOSEHANDLE( hInternet )

    RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "wininet.h"
#include "hbapi.h"


HB_FUNC( INTERNETOPEN )
{
    hb_retnl( ( LONG ) InternetOpen( hb_parc( 1 ), hb_parnl( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETCLOSEHANDLE )
{
    hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}


HB_FUNC( INTERNETCONNECT )
{
    hb_retnl( ( LONG ) InternetConnect( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( INTERNET_PORT ) hb_parnl( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) ) );
}


HB_FUNC( FTPOPENFILE )
{
    hb_retnl( ( LONG ) FtpOpenFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parnl( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( FTPGETFILESIZE )
{
    DWORD nFileSizeHigh;

    hb_retnl( ( LONG ) FtpGetFileSize( ( HINTERNET ) hb_parnl( 1 ), &nFileSizeHigh ) );
}


HB_FUNC( INTERNETREADFILE )
{
    DWORD nBytesRead;

    BOOL lSuccess = InternetReadFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parclen( 2 ), &nBytesRead );

    if ( !lSuccess )
        hb_retnl( -1 );
    else
        hb_retnl( nBytesRead );
}

#pragma ENDDUMP


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8375
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Sat Oct 25, 2008 12:26 am

Still no luck from the Desktop computer.

Both computers are running Win XP Pro SP2.
Firewalls disabled.

Right now, both computers (Laptop and Desktop) are connected to the same network.
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Antonio Linares » Sat Oct 25, 2008 9:47 am

Jeff,

Please change this line to see the bytes that are successfully written:

MsgInfo( FWRITE( hDest, cData, nRead ) )
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 41404
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Postby Enrico Maria Giordano » Sat Oct 25, 2008 11:23 am

Try also:

Code: Select all  Expand view
#define INTERNET_FLAG_PASSIVE 134217728

hConnect = INTERNETCONNECT( hInternet, "myftpaddress", INTERNET_INVALID_PORT_NUMBER, "myuserid", "mypassword", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0 )


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8375
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Sat Oct 25, 2008 3:06 pm

Enrico / Antonio,

Thank You. Thank You. Thank You.

You guys are amazing.

It's working now. :D
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Jeff Barnes » Sat Oct 25, 2008 4:56 pm

Enrico,

Sorry, one last thing...

I am trying (without success) to modify your "download" code to an "upload" version so I can still have the progress bar but it looks like I can not do it the same way.

Can a progress bar also be used when uploading using your methods?
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada

Postby Enrico Maria Giordano » Sat Oct 25, 2008 5:07 pm

Code: Select all  Expand view
#include "Fivewin.ch"


//
// File attributes
//

#define FILE_ATTRIBUTE_READONLY  1
#define FILE_ATTRIBUTE_HIDDEN    2
#define FILE_ATTRIBUTE_SYSTEM    4
#define FILE_ATTRIBUTE_DIRECTORY 16
#define FILE_ATTRIBUTE_ARCHIVE   32
#define FILE_ATTRIBUTE_NORMAL    128
#define FILE_ATTRIBUTE_TEMPORARY 256


//
// access types for InternetOpen()
//

#define INTERNET_OPEN_TYPE_PRECONFIG                    0   // use registry configuration
#define INTERNET_OPEN_TYPE_DIRECT                       1   // direct to net
#define INTERNET_OPEN_TYPE_PROXY                        3   // via named proxy
#define INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  4   // prevent using java/script/INS


//
// manifests
//

#define INTERNET_INVALID_PORT_NUMBER    0           // use the protocol-specific default

#define INTERNET_DEFAULT_FTP_PORT       21          // default for FTP servers
#define INTERNET_DEFAULT_GOPHER_PORT    70          //    "     " gopher "
#define INTERNET_DEFAULT_HTTP_PORT      80          //    "     " HTTP   "
#define INTERNET_DEFAULT_HTTPS_PORT     443         //    "     " HTTPS  "
#define INTERNET_DEFAULT_SOCKS_PORT     1080        // default for SOCKS firewall servers.


//
// service types for InternetConnect()
//

#define INTERNET_SERVICE_FTP     1
#define INTERNET_SERVICE_GOPHER  2
#define INTERNET_SERVICE_HTTP    3


//
// flags for FTP
//

#define INTERNET_FLAG_TRANSFER_ASCII  1
#define INTERNET_FLAG_TRANSFER_BINARY 2


//
// file access types
//

#define GENERIC_READ  2147483648
#define GENERIC_WRITE 1073741824


FUNCTION MAIN()

    LOCAL oDlg, oPrg

    DEFINE DIALOG oDlg

    @ 2, 2 PROGRESS oPrg;
           SIZE 100, 15

    @ 3, 2 BUTTON "FTP download";
           ACTION DOWNLOAD( oPrg )

    ACTIVATE DIALOG oDlg;
             CENTER

    RETURN NIL


STATIC FUNCTION DOWNLOAD( oPrg )

    LOCAL hInternet, hConnect, hSource, hDest, nRead

    LOCAL cData := SPACE( 1024 )

    LOCAL nPos := 0

    hInternet = INTERNETOPEN( "Anystring", INTERNET_OPEN_TYPE_DIRECT, 0, 0, 0 )

    hConnect = INTERNETCONNECT( hInternet, "myftpaddress", INTERNET_INVALID_PORT_NUMBER, "myuserid", "mypassword", INTERNET_SERVICE_FTP, 0, 0 )

    hDest = FTPOPENFILE( hConnect, "/emagsoftware.it/test/atest.prg", GENERIC_WRITE, 0, 0 )

    oPrg:SetPos( 0 )

    oPrg:SetRange( 0, FSIZE( "FTPWRITEFILE.PRG" ) )

    hSource = FOPEN( "FTPWRITEFILE.PRG" )

    WHILE .T.
        nRead = FREAD( hSource, @cData, LEN( cData ) )

        IF nRead = 0
            IF FERROR() = 0
                ? "Upload OK"
            ELSE
                ? "Read error"
            ENDIF

            EXIT
        ENDIF

        IF !INTERNETWRITEFILE( hDest, @cData, nRead )
            ? "Upload error"
            EXIT
        ENDIF

        nPos += LEN( cData )

        oPrg:SetPos( nPos )
    ENDDO

    FCLOSE( hSource )

    INTERNETCLOSEHANDLE( hSource )

    INTERNETCLOSEHANDLE( hConnect )

    INTERNETCLOSEHANDLE( hInternet )

    RETURN NIL


#pragma BEGINDUMP

#include "windows.h"
#include "wininet.h"
#include "hbapi.h"


HB_FUNC( INTERNETOPEN )
{
    hb_retnl( ( LONG ) InternetOpen( hb_parc( 1 ), hb_parnl( 2 ), hb_parc( 3 ), hb_parc( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( INTERNETCLOSEHANDLE )
{
    hb_retl( InternetCloseHandle( ( HINTERNET ) hb_parnl( 1 ) ) );
}


HB_FUNC( INTERNETCONNECT )
{
    hb_retnl( ( LONG ) InternetConnect( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), ( INTERNET_PORT ) hb_parnl( 3 ), hb_parc( 4 ), hb_parc( 5 ), hb_parnl( 6 ), hb_parnl( 7 ), hb_parnl( 8 ) ) );
}


HB_FUNC( FTPOPENFILE )
{
    hb_retnl( ( LONG ) FtpOpenFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parnl( 3 ), hb_parnl( 4 ), hb_parnl( 5 ) ) );
}


HB_FUNC( FTPGETFILESIZE )
{
    DWORD nFileSizeHigh;

    hb_retnl( ( LONG ) FtpGetFileSize( ( HINTERNET ) hb_parnl( 1 ), &nFileSizeHigh ) );
}


HB_FUNC( INTERNETREADFILE )
{
    DWORD nBytesRead;

    BOOL lSuccess = InternetReadFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parclen( 2 ), &nBytesRead );

    if ( !lSuccess )
        hb_retnl( -1 );
    else
        hb_retnl( nBytesRead );
}


HB_FUNC( INTERNETWRITEFILE )
{
    DWORD nBytesWritten;

    BOOL lSuccess = InternetWriteFile( ( HINTERNET ) hb_parnl( 1 ), hb_parc( 2 ), hb_parnl( 3 ), &nBytesWritten );

    hb_retl( lSuccess );
}

#pragma ENDDUMP


EMG
User avatar
Enrico Maria Giordano
 
Posts: 8375
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia

Postby Jeff Barnes » Sat Oct 25, 2008 7:28 pm

Once again, thanks Enrico.

I hope you know just how much we all appreciate your help here on these forums (and I do think I speak for all of us on this one).

Not only do you know your stuff ... you are also very quick to reply.



Image
Thanks,
Jeff Barnes

(FWH 16.11, xHarbour 1.2.3, Bcc730)
User avatar
Jeff Barnes
 
Posts: 929
Joined: Sun Oct 09, 2005 1:05 pm
Location: Ontario, Canada


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 43 guests