radboudp
01-18-2005, 07:29 AM
Hi,
I have a problem adding pushpins to a map using MS VC ++ 6.0. This is my code:
theApp.LockMapPointApp();
// Create a new pushpin object to represent the antenna:
pPin = new CPushpin;
// Open the MapPoint map...
// theApp.GetMapPointApp() returns a MapPoint.Application object...
theApp.GetMapPointApp().OpenMap( m_csMapPointFile, FALSE );
// Find the location where the antenna needs to be placed:
CLocation loc;
loc = theApp.GetMapPointApp().GetActiveMap().GetLocation ( dblLatitude, dblLongitude, 0 );
if ( bCenterOn )
// Center on the newly added pin...
loc.GoTo();
try
{
CMap1 map = theApp.GetMapPointApp().GetActiveMap();
// Add the pushpin and set the name (if any)...
if ( ! csName.IsEmpty() )
*pPin = map.AddPushpin( loc, csName );
else
*pPin = map.AddPushpin( loc, "<Nameless>" );
}
catch ( COleDispatchException *ex )
{
dwLastError = ::GetLastError();
iErrNo = errno;
ex->GetErrorMessage( szError, 1024 );
theApp.Log( LOG_MAP_ERROR, m_iId, _T("MapPoint OleDispatchException while adding PushPin: %s"), szError );
}
// Save the pushpin reference instance
...
// Do some settings...
...
theApp.UnlockMapPointApp();
--- End code ---
It is the "*pPin = map.AddPushpin( loc, csName );" line of code that throws the exception.
Any kind of help would be appreciated...
Many thanks,
Radboud
PS: Another application using a MappointControl object works just fine...
I have a problem adding pushpins to a map using MS VC ++ 6.0. This is my code:
theApp.LockMapPointApp();
// Create a new pushpin object to represent the antenna:
pPin = new CPushpin;
// Open the MapPoint map...
// theApp.GetMapPointApp() returns a MapPoint.Application object...
theApp.GetMapPointApp().OpenMap( m_csMapPointFile, FALSE );
// Find the location where the antenna needs to be placed:
CLocation loc;
loc = theApp.GetMapPointApp().GetActiveMap().GetLocation ( dblLatitude, dblLongitude, 0 );
if ( bCenterOn )
// Center on the newly added pin...
loc.GoTo();
try
{
CMap1 map = theApp.GetMapPointApp().GetActiveMap();
// Add the pushpin and set the name (if any)...
if ( ! csName.IsEmpty() )
*pPin = map.AddPushpin( loc, csName );
else
*pPin = map.AddPushpin( loc, "<Nameless>" );
}
catch ( COleDispatchException *ex )
{
dwLastError = ::GetLastError();
iErrNo = errno;
ex->GetErrorMessage( szError, 1024 );
theApp.Log( LOG_MAP_ERROR, m_iId, _T("MapPoint OleDispatchException while adding PushPin: %s"), szError );
}
// Save the pushpin reference instance
...
// Do some settings...
...
theApp.UnlockMapPointApp();
--- End code ---
It is the "*pPin = map.AddPushpin( loc, csName );" line of code that throws the exception.
Any kind of help would be appreciated...
Many thanks,
Radboud
PS: Another application using a MappointControl object works just fine...