How to save the last used URL in VFP?  
Author Message
KoenP





PostPosted: Visual FoxPro General, How to save the last used URL in VFP? Top

Hi,
I have this functionality in which the user is able to selct a webpage in my form, oBrowser = CREATEOBJECT("Internetexplorer.application")
oBrowser.navigate(tcURL)
now I would like to save the last used URL when user 'returns' to the (VFP9.0SP1) application.

lcNewURL=oBrowser.LocationURL returns ""

How to proceed to save this

Thanks,



Visual FoxPro2  
 
 
David Frankenbach





PostPosted: Visual FoxPro General, How to save the last used URL in VFP? Top

When are you trying to access the LocationURL property After navigation to the page is complete the property is filled in correctly for me in my testing. You can also look at the BeforeNavigate2() event to trap/save the URL.

 
 
KoenP





PostPosted: Visual FoxPro General, How to save the last used URL in VFP? Top

David,

here is my coding:

lcStart_ZIP = "1012KK"
lcStart_ADDRESS = "Rokin"
lcStart_CITY = "Amsterdam"
lcDestination_ADDRESS = alltrim(.cAddress.value)
lcDestination_ZIP = alltrim(.cPostalCode.value)
lcDestination_CITY = alltrim(.cCity.value)
if !empty(lcDestination_ADDRESS) and !empty(lcDestination_ZIP) and !empty(lcDestination_CITY)
lGoOn = .t.
endif
cUrl = "http://maps.msn.nl/(fod04h45plkqt1452pedqs45)/DirectionsFind.aspx "+;
"strt1=" + lcStart_ADDRESS+;
"&zipc1=" + lcStart_ZIP+;
"&city1=" + lcStart_CITY+;
"&strt2=" + lcDestination_ADDRESS+;
"&zipc2=" + lcDestination_ZIP+;
"&city2=" + lcDestination_CITY+;
"&stnm1=" +;
"&cnty1=12" +;
"&stnm2=" +;
"&cnty2=12" +;
"&src=GM"
if lGoOn = .t.
public lcNewURL
public oBrowser
oBrowser = createobject("internetexplorer.application")
oBrowser.navigate(cUrl)
oBrowser.visible = .t.
endif
lcNewURL=oBrowser.LocationURL
ThisForm.URL = lcNewURL
wait window ThisForm.URL &&&for debugging purpose

consider this scenario:
User activates my coding - IE opens and user changes the starting point making the URL to change, this new URL I would like to save for further and future processing.

Thanks for replying.

Koen

 
 
David Frankenbach





PostPosted: Visual FoxPro General, How to save the last used URL in VFP? Top

Koen,

I'm pretty sure (I don't have time to test this right now) the LocationURL doesn't populate until navigation is complete. So after you call the Navigate() method you need to go into a polling loop:

do while ( oBrowser.busy )
doevents
enddo

You can also check the DocumentComplete property.



 
 
KoenP





PostPosted: Visual FoxPro General, How to save the last used URL in VFP? Top

David,

I believe you are correct, however although I had implented a loop I still could not catch the renewed URL. After looking to this problem almost a full (heavy raining) weekend I decided to make a different approach in my application which pleases me also. When this whole thing is done I will 'Just4Fun' atack this problem once more and in case I found the final solution I will post it here for your interest.

Thanks for m****support.

Koen