DialInternet Method
Class: FTP_SERVICE
Description:Attempts to use a preconfigured Dial Up account to connect to the internet
Attempts to use a preconfigured Dial Up account to connect to the internet.
=
Object.DialInternet
Parameter
lcDialUpName
Name of the DialUp Connection to use.
Type Character
Direction Input
lnFlag
Type Numeric
Direction Input
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 Integer
Connection handle number. 0 if API Call unsuccessful or -1 if foxpro function failed.
Example
LOCAL loFTP, liState,liCID 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? liCID=loFTP.DialInternet("MACONNEXION",1) ENDIF IF (BITTEST(liState,0) AND liCID>0 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.DialHangUp(liCID) RELEASE PROCEDURE ftp.prg
See also
Expand/Collapse source code of procedure DialInternet Source Code
      LPARAMETERS INP lcDialUpName, INP lnFlag
      LOCAL fResult, lnConnectionID, lnHWNDHandle
      IF This.LoadAPIFuncs() != ERROR_SUCCESS
         RETURN -1
      ENDIF
                
      STORE 0 TO lnConnectionID,lnHWNDHandle
                                                      
      IF TYPE("m.lcDialUpName") != "C" OR ;
         TYPE("m.lnFlag") != "N"
         RETURN -1
      ENDIF
                
      IF LEN(ALLTRIM(m.lcDialUpName)) = 0 
         RETURN -1
      ENDIF
                  
      lcDialUpName = m.lcDialUpName + cNULL
      =This.BeforeDialInternet(m.lcDialUpName, m.lnFlag)
      fResult = InternetDial(m.lnHWNDHandle, @m.lcDialUpName, m.lnFlag, @m.lnConnectionID, 0)
      =This.GetExtendedError()
      =This.AfterDialInternet(@m.lcDialUpName, m.lnFlag, m.lnConnectionID, m.fResult)
      RETURN m.lnConnectionID