I am writing my code in C++ and at this point all I want to do is add a line to the map and then be able to delete it. I can add the line just fine and I do it with the following code:
void MapPt:: DrawLine(double Lat1, double Long1, double Lat2, double Long2)
{
//create a location object for each point
WyptLocPtr1 = m_myMap->GetLocation( Lat1, Long1, 4 );
locWypt1 = (Location*)WyptLocPtr1;
WyptLocPtr2 = m_myMap->GetLocation( Lat2, Long2, 4 );
locWypt2 = (Location*)WyptLocPtr2;
//create a shapes object
NavLinesPtr = m_myMap->GetShapes();
NavLines = (Shapes*)NavLinesPtr;
Shape* L;
L = NavLines->AddLine(locWypt1,locWypt2);
}
After I have created this line on the map I cannot delete it though. To delete I just use the following code:
Line->Delete()
My software just crashes here, and the error I get is access violation. Any help here would be much appreciated.