views:

688

answers:

1

Hello

I'm writing a MFC app that uses the MS Mappoint OCX. I need to display the locations of people and vehicles on the map and the best of doing this appears to be with Pushpin objects. I have no problem displaying a stock pushpin icon with some text but want to change the icon to a custom designed one. From the limited amount of Mappoint programming info out there it appears the way to do this is to create a symbol object from a symbols object then assign this to a pushpin like this ..

CSymbols symbols;
CSymbol symbol;

symbol=symbols.Add("c:/temp/myicon.ico");
pushpin.put_Symbol(symbol.get_ID());

But the program crashes with a unhandled exception on the symbols.add instruction.

Can anyone tell me what I am doing wrong here ? or am I on totally the wrong track ?

Thanks for your time

Ian

A: 

I found the solution to this one myself. The following code works ..

CSymbols symbols;
CSymbol symbol;

symbols=map.get_Symbols();
symbol=symbols.Add("c:/temp/myicon.ico");
pushpin.put_Symbol(symbol.get_ID());

Where map is the Mappoint control.

IanW