= Question: My Project Crashes after a mouse click on the Map = I am working on a project that uses both ILayer and IMap interfaces. I was adding code to the Layer_Editor_C++ app in the SDK, and I created the IMap wrapper class just like the ILayer class was created. Also, in the !CreateServicesObjects() method I created an IDispatch for IMap shown below : {{{ m_map = new FVW_IMap; if (m_map->m_lpDispatch == NULL && !m_map->CreateDispatch(clsid_map, e)) { AfxMessageBox("Unable to create FalconView.Map object"); AfxThrowUserException(); delete m_map, m_map = NULL; } }}} I've created in my toolbar that when selected and the map is clicked, the map is recentered using SetMapDisplay (under IMap). Whenever I call this button and click on the map FV crashes. I've traced it to when my program calls !InvokeHelper (in my wrapper class) for the SetMapDisplay, it then calls InvokeHelperV, when InvokeHelperV is called it throws an exception. Below is what is shown in the call stack: {{{ > msvcr80d.dll!_malloc_dbg(unsigned int nSize=3765269347, int nBlockUse=1, const char * szFileName=0x00000003, int nLine=1241664) Line 191 + 0x1b bytes C++ msvcr80d.dll!_CxxThrowException(void ''' pExceptionObject=0x0012f264, const _s__ThrowInfo ''' pThrowInfo=0x783d3fb8) Line 161 C++ mfc80d.dll!AfxThrowOleException(long sc=-2147352571) Line 429 C++ mfc80d.dll!COleDispatchDriver::InvokeHelperV(long dwDispID=13, unsigned short wFlags=1, unsigned short vtRet=3, void ''' pvRet=0x0012f4a8, const unsigned char * pbParamInfo=0x014448b4, char ''' argList=0x0012f3d8) Line 436 C++ mfc80d.dll!COleDispatchDriver::InvokeHelper(long dwDispID=13, unsigned short wFlags=1, unsigned short vtRet=3, void ''' pvRet=0x0012f4a8, const unsigned char ''' pbParamInfo=0x014448b4, ...) Line 553 C++ editor2.dll!FVW_IMap::GetElevation(double lat=0.00000000000000000, double lon=0.00000000000000000, long * elevation=0x00000000) Line 106 + 0x2e bytes C++ editor2.dll!CSample::Selected(long layer_handle=101, long object_handle=-1, double lat=36.648000000000003, double lon=-101.52077899999999, long flags=1, short ''' drag=0x0012f99e, long * hcur=0x0012f96c, wchar_t * * tooltip=0x0012f974, wchar_t * * helptext=0x0012f978, long ''' return_val=0x0012f970) Line 299 C++ }}} Can someone help? -- !AndrewPaul - 19 Oct 2007 = Environment = || !FalconView Version: || FalconView 4.0.1 || || Interface: || ILayerEditor || || Language: || Visual C++ || (EDIT ICON) -- !ChrisBailey - 02 Nov 2007 = Answer = Based on the call stack NULL is being passed in for the elevation parameter of !GetElevation. It should look something like: {{{ #import "fvw.tlb" no_namespace, named_guids { ... try { IMapPtr spMap(__uuidof(Map)); long lElevation; spMap->GetElevation(0, 0, &lElevation); } catch(_com_error &e) { // log error here } } }}}