>Hello:
>I'm trying to download a file programaticaly, from a FTP server, and i'm using the following code (resumed):
>
> DECLARE INTEGER InternetCloseHandle ;
> IN WinInet.DLL ;
> INTEGER
>
> DECLARE INTEGER InternetOpen ;
> IN WININET.DLL ;
> STRING,;
> INTEGER,;
> STRING, STRING, INTEGER
>
> DECLARE INTEGER InternetConnect ;
> IN WININET.DLL ;
> INTEGER IPHandle,;
> STRING Server,;
> INTEGER Port, ;
> STRING UserName,;
> STRING Password,;
> INTEGER ServiceFlags,;
> INTEGER Reserved,;
> INTEGER Reserved
>
> DECLARE Integer FtpGetFile ;
> IN WinInet.dll ;
> Integer IPSession,;
> String Source,;
> String Target, ;
> Integer NoOverwrite,;
> INTEGER Attributes, ;
> Integer Flags, ;
> Integer Context
>
>
>* Here begins my problem
>* I don't know what should be the value for dwAccessType:
>* it should be one of the following:
>* INTERNET_OPEN_TYPE_DIRECT, INTERNET_OPEN_TYPE_PRECONFIG, ...,
>* INTERNET_OPEN_TYPE_PROXY
>* but these are constant values that i've not defined anywhere,
>* if i search MSDN, they say that dwAccessType should be:
>* INTERNET_OPEN_TYPE_DIRECT, INTERNET_OPEN_TYPE_PRECONFIG, ...,
>* or INTERNET_OPEN_TYPE_PROXY
>* what a help, anyone know's what is the value of these constants?
>
> hInetConnection = InternetOpen("Microsoft® Internet Explorer",;
> dwAccessType,;
> NULL,NULL,0)
>
>* Here, other problem, the constant: INTERNET_PORT.
>* Once again MSDN was so helpful. It says that INTERNET_PORT
>* should have one of the following values INTERNET_DEFAULT_FTP_PORT,
>* INTERNET_...,
>* but what are the possible literal values?
> lhFTPSession = InternetConnect(hInetConnection,;
> lcServer,;
> lnHTTPPort,;
> lcUsername,;
> lcPassword,;
> INTERNET_PORT,;
> m.nServiceFlags,0)
>
> lnResult = FtpGetFile(m.hFTPSession,lcSource,;
> lcTarget,0,FILE_ATTRIBUTE_NORMAL,;
> lnBinary + INTERNET_FLAG_RELOAD,0)
>
>Because i don't know the value of none of these constants, i go on tries. And, of course this code don't work. Anyone can help me?
>
>Thank you in advance.
>Joaquim
Joaquim,
If you have C++ installed all those constants are defined in wininet.h (include folder). Here is part of it :
//
// 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
//
// old names for access types
//
#define PRE_CONFIG_INTERNET_ACCESS INTERNET_OPEN_TYPE_PRECONFIG
#define LOCAL_INTERNET_ACCESS INTERNET_OPEN_TYPE_DIRECT
#define CERN_PROXY_INTERNET_ACCESS INTERNET_OPEN_TYPE_PROXY
#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.
Cetin