Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Accessing a web page
Message
De
15/04/2013 12:05:04
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01570924
Message ID:
01570948
Vues:
62
>I want to be able to call this link from VFP - how do I do it
>
>http://www.logixonline.co.uk/intcouriers2/newsite/client_login/index.asp

Use the following code as a template, it's a slightly modified version of code I use in my own application. You must change the last URLs.
lnTime=12000 && 12 seconds
lox=.Null.
Release lox
Public lox
oShell = Createobject("Shell.Application")
&& A collection of the open windows that belong to the Shell
oShellWindows = oShell.Windows
For Each oIE In oShellWindows
   If "IEXPLORE.EXE" $ Justfname(Upper(oIE.FullName))
      If 'CLIENT LOGIN'$Upper(oIE.LocationName)
         lox=oIE
         llAlredyup=.T.
         Exit
      Endif
   Endif
Endfor
oShellWindows = Null
oShell = Null
If !llAlredyup And Vartype(lox)#'O'
   lox=Createobject('internetexplorer.application')
   lox.Navigate('http://www.logixonline.co.uk/intcouriers2/newsite/client_login/index.asp')
   lox.Visible=.T.
   Wait 'Navigating!' Window Nowait
   If !NavComplete(lox,lnTime)
      ??Chr(7)
      Wait 'Timeout feil!' Window
      lox.Visible=.F.
      Release lox
      Return
   Endif
   Wait Clear
Endif
lox.Visible=.T.
declare integer SetForegroundWindow in win32api Integer
SetForegroundWindow(lox.HWND)
SetForegroundWindow(_vfp.HWNd)

If NavComplete(lox,lnTime)
   lox.Document.All.mainFrame.contentWindow.Document.Forms.login.username.Value='Username'
   lox.Document.All.mainFrame.contentWindow.Document.Forms.login.passwort.Value="password"
   lox.document.all.mainFrame.contentWindow.document.forms.login.submit.click()
   If !NavComplete(lox,lnTime)
      ??Chr(7)
      Wait 'timeout error!' Window
      lox.Visible=.F.
      Release lox
      Return
   Endif
endif

Function NavComplete
   Lpara toIE, tnTimeout
   lnTimeout=Iif( Type("tnTimeout")="N",tnTimeout ,60 )
   lnTimeElapsed=0
   lnStartSeconds=Seconds()
   Do While .T.
      If toIE.ReadyState=4 And !toIE.Busy
         Do While .T.
            If toIE.Document.ReadyState="complete"
               Return .T.
            Endif
            If (Seconds()-lnStartSeconds)>lnTimeout
               Return .F.
            Endif
         Enddo
      Endif
      If (Seconds()-lnStartSeconds)>lnTimeout
         Return .F.
      Endif
   Enddo
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform