Hello
I have an application over Visual C++ and i need to find the nearest city to an geografic point (latitud , longuitud ) . I have the following code but is crashing in the GetStreetAddress() function. Does anyone have any idea ??
Code:
CLocation loc,streetLoc;
CFindResults streetResults;
CStreetAddress callejero;
loc = mapa.GetLocation(lat, lon, 0);
loc.GoTo();
streetResults = mapa.ObjectsFromPoint(mapa.LocationToX(loc), mapa.LocationToY(loc));
int numResult=streetResults.GetCount();
int i=1;
while ( i <=numResult)
{
VARIANT idx;
VariantInit( &idx );
V_VT(&idx) = VT_I4;
V_I4(&idx) = 1;
streetLoc=streetResults.GetItem( &idx );
szLocalidad=streetLoc.GetLocation().GetName();
callejero=streetLoc.GetStreetAddress();
i++;
}