i am using the arcGIS api to make a plugin for arcFM, when i try to run this code
Type t = Type.GetTypeFromProgID("esriFramework.AppRef");
System.Object obj = Activator.CreateInstance(t);
pApp = obj as IApplication;
i get
System.Runtime.InteropServices.COMException(0x8000FFFF): Creating an instance of the component with CLSID {Appref CLSID HERE} from the IClassFactory faileddue to the following error: 8000ffff
-
Can you do a createinstance on other Esri types (e.g. esriGeometry.Point), or just having problems with AppRef?Kirk Kuykendall– Kirk Kuykendall2011年04月25日 20:25:14 +00:00Commented Apr 25, 2011 at 20:25
-
Is this in a dll project? I wouldn't expect it to work in an exe project.Kirk Kuykendall– Kirk Kuykendall2011年04月25日 20:26:29 +00:00Commented Apr 25, 2011 at 20:26
-
What kind of ArcFM extension are you developing? Is it an autoupdater? If that's the case, you should never rely on the IApplication being present since AUs can also be run in different context than an ESRI desktop application.Petr Krebs– Petr Krebs2011年04月25日 21:40:34 +00:00Commented Apr 25, 2011 at 21:40
2 Answers 2
Looks like you might not have initialized the ESRI ArcObjects libraries. You have to do that, to get your license set. You need to check here; ESRI Library to make sure you are getting the libraries started up properly.
-
I am using the example code from MMStartup.cs and the exact same code seems to work fine thereEric Fode– Eric Fode2011年04月25日 20:00:51 +00:00Commented Apr 25, 2011 at 20:00
-
1Ok, Looks like I missed this - '{Appref CLSID HERE}' - to me this is looking like its not seeing your extension being registerd with ArcGIS, so it may be trying to get to your custom code and isn't knowing what to start up.D.E.Wright– D.E.Wright2011年04月25日 20:20:42 +00:00Commented Apr 25, 2011 at 20:20
Assuming that you are running the code within an ESRI-app process (e.g. ArcMap, ArcCatalog), if you need to get a reference to a running IApplication from a standalone application, you can use the AppROT class.
-
how do i use the AppROT class?Eric Fode– Eric Fode2011年04月26日 14:37:32 +00:00Commented Apr 26, 2011 at 14:37