IMapControl's AddShapeFile C++ method returns 'E_UNEXPECTED' in Engine applications created with VS 2003.
Last Published: August 25, 2014No Product Found
Bug ID Number
NIM005635
Submitted
December 15, 2006
Last Modified
June 5, 2024
Applies to
No Product Found
Version found
9.1
Version Fixed
9.2
Status
Fixed
The bug has been fixed. See the Version Fixed and Additional Information, if applicable, for more information.
Workaround
add the shapefile by using the AddLayer method, something like: CComPtr<IWorkspaceFactory> pWorkspaceFactory; CComPtr<IWorkspace> pWorkspace; nEC = pWorkspaceFactory.CoCreateInstance(CLSID_ShapefileWorkspaceFactory); nEC = pWorkspaceFactory->OpenFromFile(L"<a href="file:C://Temp//USA" target="_blank">C:\\Temp\\USA</a>", NULL,&pWorkspace); nEC = pWorkspace->QueryInterface(IID_IFeatureWorkspace,(LPVOID*)&piFWS); nEC = piFLayer1.CoCreateInstance(CLSID_FeatureLayer); nEC = piFWS->OpenFeatureClass(L"cities.shp",&piOutputFC); nEC = piFLayer1->putref_FeatureClass(piOutputFC); nEC = piOutputFC->get_AliasName(&cbstrFName); nEC = piFLayer1->put_Name(cbstrFName); nEC = piMapControl->AddLayer(piFLayer1,0);