Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to use MapInfo's Mapmarker Geocoding with VFP
Message
From
05/12/2002 16:19:31
 
General information
Forum:
Visual FoxPro
Category:
Third party products
Miscellaneous
Thread ID:
00723501
Message ID:
00730063
Views:
67
Still cannot get the Mapmarker ActiveX control to work!!!

When I drop it on a Foxpro form, it's self-contained GUI runs like a champ.

But, when I try to use the OLE control methods with Foxpro data, I continue to get "OLE Error Code: 0x80020005: Type mismatch" no matter what I do.

HELP!!!!!!!!!!!!

Command button Click() code snippet follows:




* Foxpro form description:

* Three unbound input data fields: txtFirm, txtStreet, txtLastLine
* (no Input formatting nor max character nor default value setting)
* txtLastLine would normally have something like "Austin, TX 78759"

* Two unbound output data fields: txtLatitude, txtLongitude (no formatting or initialization)

* One OLE control, OLEGeoCodeControl, representing the MapInfo Mapmarker Geocode Control
* with its self-contained GUI Form Visible property set FALSE
* Use it simply to call Methods

* Three command buttons:

* cmdDoProperties - calls the ActiveX control's Properties Page
* (this works fine, so I know the ActiveX control is recognized and available to call methods)

* cmdClose - thisform.Release()

* cmdGeocode (with code shown below)

* Use string representation of double ampersand characters to keep
* VFP from getting hysterical when they appear in a string literal
LOCAL strAmpDouble as String

* GeocodeAddressLastLine() input data (use control variables)
LOCAL strFirm, strStreet, strLastLine

* output parameters
LOCAL lngHandle as Long
LOCAL intStatus, intCandidates, intCloseCandidates as Integer
LOCAL intIndex as Integer
LOCAL logReturn as Boolean

*!* * Store form fields in known local data types
*!* strFirm = thisform.txtfirm.Value+CHR(0)
*!* strStreet = thisform.txtStreet.Value+CHR(0)
*!* strLastLine = thisform.txtLastLine.Value+CHR(0)

* Initialize - TEST DATA
lngHandle = 0
intStatus = 0
intCandidates = 0
intCloseCandidates = 0

intIndex = 0

* Try getting this dog to work with raw data

strFirm = "RAS GROUP, INC."
strStreet = "8800 BUSINESS PARK DRIVE"
strLastLine = "AUSTIN, TX 78759"

***************************************************************************
* Call below ALWAYS generates "OLE Error: 0x800200005: Type Mismatch" error
* whether or not I pass input by reference or attach CHR(0) to string data or
* I use a simple street address with no double ampersand or use the data
* directly, ie, thisform.txtStreet.Value or in a control value variable.
***************************************************************************

logReturn = thisform.oleGeoCodeControl.GeocodeAddressLastline( ;
@lngHandle, ;
strFirm, ;
strStreet, ;
strLastLine, ;
@intStatus, @intCandidates, @intCloseCandidates ;
)

***************************************************************************

* Get Latitude/Longitude values from geocoded variables
thisform.txtLatitude.Value = thisform.oleGeoCodeControl.GetCandidateLatitudeAt(intIndex)
thisform.txtLatitude.Value = thisform.oleGeoCodeControl.GetCandidateLatitudeAt(intIndex)

RETURN .T.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform