Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Accessing a web page
Message
 
To
15/04/2013 12:05:04
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
01570924
Message ID:
01571031
Views:
52
>>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
Thanks Tore - I have another solution but I will try yours
Specialist in Advertising, Marketing, especially Direct Marketing

I run courses in Business Management and Marketing
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform