VC++ 6.0
MP 2006
ActiveX/COM
Hello here I am again,
I've a poblem. In OnSelectionChange message, I want to turn on/off the balloon of a selected pushpin.
I managed to get the pushpin object this way:
To know wether it is a pushpin I've created and saved it in my own DataSet, I check the name of the DataSet by using MyPushpin.Code:void CDigiLocDlg::OnSelectionChangeControlMap(LPDISPATCH pNewSelection, LPDISPATCH pOldSelection) { CPushpin MyPushpin( pNewSelection ); MyPushpin.SetBalloonState( 0 or 2 ); }
(Just create a DataSet out of MyPushpin and call DataSet's memberfunction GetName() ). If its name is not "Map", than it's a pushpin of one of my DataSets. If it is "Map" than it's not my pushpin, or shape or something else, but it's an object of Mappoint's map.
Everything looks fine, but the problem is releasing the pushpin. I've tried MyPushpin.ReleaseDispatch(), Detach or wathever, however I still get that Acces Violation, which means something writes data in a forbidden memory part. I really don't know how to solve that. If somebody can say that ReleaseDispatch is the right one for sure. Than I can check somewhere else.
I hope somebody with good VC++ and COM skills can help me.
Thank you.