Failed to connect to ftp server

I am trying to connect to an ftp server through a powerbuilder application using the windows api features. I manage to connect to the ftp server via Internet Explorer (so I don’t think this is a permission problem), but the application does not work for some unknown reason.

String  ls_Null, &
            ls_id
Integer li_rc

li_rc = 1

IF Not InternetAutodial(AUTODIAL_FORCE_UNATTENDED, 0) THEN
    f_write_to_err_log('IMPORT Unable To Connect Internet - Dialup')
    li_rc = -1
ELSE
    SetNull(ls_Null)
    ls_id = "Care_Dsend"
    al_internet_handle = InternetOpen(ls_id, INTERNET_OPEN_TYPE_DIRECT, ls_Null, ls_Null, 0)        

    IF al_internet_handle > 0 THEN
        al_ftp_connect_handle = InternetConnect(al_internet_handle, is_ftp_url, il_ftp_port, is_ftp_user, is_ftp_password, INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, al_ref) 
    END IF
END IF

Return li_rc


//al_internet_handle, al_ftp_connect_handle are by ref long parms
//al_ref is a by ref unsignedlong parm
//is_ftp_url, is_ftp_user, is_ftp_password are strings
//il_ftp_port is long

The function controls the return of the descriptor from the InternetOpen api api function, but returns 0 from the InternetConnect function.

Any ideas?

+3
source share
2 answers

Well, I found out what the problem is. I missed Ansi at the end of the declaration of my function, as in:

ulong InternetOpen (ref string lpszAgent, ulong dwAccessType, ref lpszProxy, ref lpszProxyBypass, ulong dwFlags) "WININET.DLL" "InternetOpenA ; Ansi"

+2

, InternetAutodial(), InternetOpen() ..? ( , Powerbuilder 11.2), PFC. , Powerbuilder .

, :

+1

All Articles