Problem Registering ArcGIS Engine License

1083
7
12-13-2011 11:27 AM
JeffreyHanson3
New Contributor
After using RuntimeManager.Bind as            ESRI.ArcGIS.RuntimeManager.Bind(ESRI.ArcGIS.ProductCode.Engine)

we try to get the IApplication for ArcGIS Engine with the following code:
            Dim t As Type = Type.GetTypeFromProgID("esriFramework.AppRef")
            Dim obj As System.Object = Activator.CreateInstance(t)
            Dim m_pApplication As ESRI.ArcGIS.Framework.IApplication = obj   'New ESRI.ArcGIS.Framework.AppRef

but we keep getting an exception:

Retrieving the COM class factory for component with CLSID {E1740EC5-9513-11D2-A2DF-0000F8774FB5} failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE)).

We've upgraded the app from 9.3 to 10.0 and I have used ESRIRegAsm.exe but to no avail.  Has anyone else encountered this or have a possible solution?
0 Kudos
7 Replies
NeilClemmons
Regular Contributor III
I'm confused.  There is no IApplication for Engine.  Only the ArcGIS Desktop applications (ArcMap, ArcCatalog, etc) implement IApplication.  What are you trying to do?
0 Kudos
JeffreyHanson3
New Contributor
Your right.  I just inherited this app which I thought was purely Engine so I am new to Engine.  Still, I get the COM error when getting the AppRef which should initialize the IApplication interface according to the blogs.  There is a runtimemanger.bindlicense in the form startup.
0 Kudos
NeilClemmons
Regular Contributor III
I'm still confused as to what you're trying to do.  Getting the AppRef returns a reference to the currently running ArcGIS Desktop application.  If your code isn't running inside of an ArcGIS Desktop application then the call will fail.  AppRef can't be used outside of ArcMap, ArcCatalog, etc.
0 Kudos
JeffreyHanson3
New Contributor
That is what is going on.  The app is primarily Engine, with a map control, but the original developer was trying to use arc editing functionality - add a street for example - without having arcmap open.  I may have to do a major redesign though his user interface with the map control is quite good.
0 Kudos
NeilClemmons
Regular Contributor III
You don't need an IApplication reference to edit data nor do you need ArcMap.  ArcGIS Engine comes with quite a few built-in tools that you may be able to use.  There may also be geoprocessing tools that can help you do what you need to do.  Anything else you need can be programmed with ArcObjects.
0 Kudos
JeffreyHanson3
New Contributor
Thanks.  I'm going to have to re-architect some of the code.  Some of it also has to do with 9.3 to 10.0 migration.
0 Kudos
nazerehnejatbakhsh
New Contributor
Dear Neil,
I belive you can help me on following issue:
all what I need is to Open an ArcScene, create a FileGDB (testGDB.gdb), create a FeatureClass inside of it and add a Polyline to it, add the feature class as a Layer to my ArcScene.
I have written following codes :
::CoInitialize(NULL);
ArcGISVersionLib::IArcGISVersionPtr ipVer(__uuidof(ArcGISVersionLib::VersionManager));
VARIANT_BOOL succeeded;
if (FAILED(ipVer->LoadVersion(ArcGISVersionLib::esriArcGISDesktop, L"10.0", &succeeded)))
  return 0;
OLE_HANDLE iphWnd = NULL;
//Connect to ArcScene
IAppROTPtr mpAppROT(CLSID_AppROT);
IApplicationPtr ipApplication(CLSID_AppRef);  //---------> I get here always class is not registered BUT, I ArcScene opens !!!!
ISxDocumentPtr ipSxDoc(CLSID_SxDocument);
             IDocumentPtr ipDoc(ipSxDoc);
             ipDoc->get_Parent(&ipApplication);
             ipApplication->put_Visible(VARIANT_TRUE);
ipApplication->get_hWnd(&iphWnd);
IMapPtr ipMap(CLSID_Map);
then I start creating my FileGDB:
             IWorkspaceFactoryPtr ipWkspFct(CLSID_FileGDBWorkspaceFactory);
IWorkspaceNamePtr ipWkspNam(CLSID_WorkspaceName);
ipWkspFct->Create(NULL, gdbName, NULL, NULL, &ipWkspNam);
up to here, it works properly and the gdb gets created.
             IWorkspacePtr ipWksp(CLSID_Workspace);
             ipWkspFct->OpenFromFile(gdbPath, NULL, &ipWksp); //-------> here is the problem ! always NULL for ipWksp.
Any Idea !? as I am a new VC++ programmer, please give me some instructions !
I have ArcGIS Desktop 10.0 and VS2008

Thank you vor any help 🙂
Nazereh
0 Kudos