4

I'm trying to follow the Identify snippet from the ESRI ArcEngine SDK http://help.arcgis.com/en/sdk/10.0/arcobjects_net/componenthelp/index.html#/Do_Identify_Snippet/00490000000n000000/

The third line of the tutorial throws a COM exception:

public void DoIdentify(ESRI.ArcGIS.Carto.IActiveView activeView, System.Int32 x, System.Int32 y)
{
  if(activeView == null) return;
  ESRI.ArcGIS.Carto.IMap map = activeView.FocusMap;
  ESRI.ArcGIS.CartoUI.IIdentifyDialog identifyDialog = new ESRI.ArcGIS.CartoUI.IdentifyDialogClass();  //THIS LINE THROWS THE EXCEPTION


{"Retrieving the COM class factory for component with CLSID {F8AAB776-8B1E-11D3-9F7A-00C04F6BC886} failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))."}

I expect to run into some trouble using the snippets, but I can't even call a constructor... : (

Any thoughts are appreciated...

Specs: ESRI ArcEngine 10 VS 2010 C#

Edit: Maybe I don't have access to the CartoUI library. I also tried this:

AdvancedDrawingDialogClass t = new ESRI.ArcGIS.CartoUI.AdvancedDrawingDialogClass(); 

But I got a similar error.

Edit 2: I found out how to do the identification so I'm going to post it for the community.

for (int i = 0; i < mapControl.LayerCount; i++)
{
  ILayer layer = mapControl.get_Layer(i);
  if (!(layer is IDynamicLayer))
  {
    ESRI.ArcGIS.Carto.IIdentify identify1 = layer as IIdentify;
    IArray array = identify1.Identify(geometry);
    if (array != null)
    {
      object obj = array.get_Element(0);
      IFeatureIdentifyObj fobj = obj as IFeatureIdentifyObj;
      IRowIdentifyObject irow = fobj as IRowIdentifyObject;
      IFeature feature = irow.Row as IFeature;
      IGeometry geometry1 = feature.Shape; 
    }
  }
}
4

It's only available in Desktop and not Engine, according to the API documentation: IdentifyDialog CoClass

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.