AutoDialInternet Method
Class: FTP_SERVICE
Description:Automatically dial the default Internet connection
Causes the modem to automatically dial the default Internet connection.
=
Object.AutoDialInternet
(lnType)
Parameter
lnType
Connect type
Type Numeric
Direction Input
Can be one of the following:
ValueDescription
INTERNET_AUTODIAL_FORCE_ONLINEForces an online Internet connection.
INTERNET_AUTODIAL_FORCE_UNATTENDEDForces an unattended Internet dial-up.
INTERNET_AUTODIAL_FAILIFSECURITYCHECKCauses InternetAutodial to fail if file and printer sharing is disabled for Windows 95 or later.
Assumed from MSDN.
Return value Boolean
The return value is .T. if is connected to internet or .F. is not.
Example
LOCAL loFTP, liState,liResult SET PROCEDURE TO ftp.prg ADDITIVE loFTP=CREATEOBJECT('ftp_service') liState=loFTP.GetConnectedState() && Check Connected state IF liState=-1 ?loFTP.GetExtendedErrorCode(),loFTP.GetExtendedErrorMsg() RETURN ENDIF IF BITTEST(liState,0) && Use Modem? liResult=loFTP.AutoDialInternet(0) ENDIF IF (BITTEST(liState,0) AND liResult=1 OR !BITTEST(liState,0)) AND ; loFTP.OpenInternet("ABONNE", "PWD", "10.10.10.10", "21") * Try to get a handle into the Internet and Connect Briefly with the FTP Site * Note: Insert your USER ID, PASSWORD, FTP ADDRESS, PORT # Here * Note: ("21" is the Default Port) ?"Connection réussie" =loFTP.CloseInternet() ENDIF =loFTP.AutoDialHangUp() RELEASE PROCEDURE ftp.prg
See also
Expand/Collapse source code of procedure AutoDialInternet Source Code
      LPARAMETERS INP lnType
      LOCAL lnHWNDHandle, fResult
      IF This.LoadAPIFuncs() != ERROR_SUCCESS
           RETURN .F.
      ENDIF    
                 
      IF TYPE(m.lnType) != "N" 
         RETURN .F.
      ENDIF
                 
      =This.BeforeAutoDialInternet(m.lnType)
      lnHWNDHandle = 0              
      fResult = InternetAutodial(m.lnType, m.lnHWNDHandle)
      =This.GetExtendedError()
      =This.AfterAutoDialInternet(m.lnType,m.fResult)
      RETURN m.fResult # 0