Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Viewing street addresses from vfp
Message
From
31/07/2014 13:59:30
 
 
To
30/07/2014 17:22:44
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows Server 2012
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01604983
Message ID:
01605021
Views:
69
Below is code that I use (the form has the embedded IE activex control):
LOCAL lcURL, lcAddress
IF thisform.cboAddrList.ListItemId > 0
	IF False
		IF EMPTY(thisform.DisplayAddress)
			SELECT addresses
			GOTO RECORD thisform.cboAddrList.ListItemId IN addresses
			IF EMPTY(addresses.street1)
				lcAddress = "city="    + ALLTRIM(addresses.city) + ;
							"&state="   + ALLTRIM(addresses.stateiso) + ;
							"&zipcode=" + ALLTRIM(addresses.zipcode)
			ELSE
				lcAddress = "address="  + STRTRAN(ALLTRIM(addresses.street1), " ", "+") + ;
							"&city="    + ALLTRIM(addresses.city) + ;
							"&state="   + ALLTRIM(addresses.stateiso) + ;
							"&zipcode=" + ALLTRIM(addresses.zipcode)
			ENDIF
		ELSE
			lcAddress = thisform.DisplayAddress
		ENDIF
		lcURL = "http://www.mapquest.com/maps?" + lcAddress
*		lcURL = "http://www.mapquest.com/maps/map.adp?country=US&addtohistory=&" + lcAddress + "&homesubmit=Get+Map&size=big"
	ELSE
		IF EMPTY(thisform.DisplayAddress)
			SELECT addresses
			GOTO RECORD thisform.cboAddrList.ListItemId IN addresses
			IF EMPTY(addresses.street1)
				lcAddress = ALLTRIM(addresses.city) + "+" + ALLTRIM(addresses.stateiso) + "+" + ALLTRIM(addresses.zipcode)
			ELSE
				lcAddress = STRTRAN(ALLTRIM(addresses.street1), " ", "+") + "+" + ;
							ALLTRIM(addresses.city) + "+" + ALLTRIM(addresses.stateiso) + "+" + ALLTRIM(addresses.zipcode)
			ENDIF
		ELSE
			lcAddress = thisform.DisplayAddress
		ENDIF
*		lcURL = "http://maps.google.com?q=" + lcAddress
		lcURL = "https://www.google.com/maps?t=m&q=" + lcAddress + "&output=classic"
	ENDIF
	thisform.oleIE.Navigate(lcURL)
	DO WHILE thisform.oleIE.ReadyState != IE_READYSTATE_COMPLETE
		INKEY(1.00, "H")
	ENDDO
	RETURN True
	*-*	DO CASE
	*-*		CASE "Did you mean:" $ oIE.DOCUMENT.body.innerText
	*-*			lcresult = SUBSTR(oIE.DOCUMENT.body.innerText, AT("Did you mean:",oIE.DOCUMENT.body.innerText))
	*-*			?LEFT(lcresult,AT(CHR(13),lcresult))
	*-*			?SUBSTR(lcresult,AT(CHR(13),lcresult)+2,AT(CHR(13),lcresult,2) -AT(CHR(13),lcresult)-1)

	*-*		CASE "Address:"+CHR(13) $oIE.DOCUMENT.body.innerText

	*-*			lcresult= SUBSTR(oIE.DOCUMENT.body.innerText, AT("Address:"+CHR(13),oIE.DOCUMENT.body.innerText))
	*-*			lcout=lcresult
	*-*			ilines=1

	*-*			DO WHILE lcout <> "A." AND ilines<5
	*-*				?LEFT(lcout,AT(CHR(13),lcout)-1)
	*-*				lcout=SUBSTR(lcout,AT(CHR(13),lcout)+2)
	*-*				ilines=ilines+1
	*-*			ENDDO

	*-*		OTHERWISE
	*-*			lcresult = oIE.DOCUMENT.body.innerText
	*-*			STRTOFILE(lcresult,'temp.txt')
	*-*	ENDCASE
ELSE
	RETURN False
ENDIF
You will also need to set the following setting in the registry for the browser to work without script error messages:

[HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Internet Explorer\MAIN\FeatureControl\FEATURE_BROWSER_EMULATION]
"vfp.exe"=dword:0000270f
"yourexename.exe"=dword:0000270f
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform