Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

Trying to use the following code with an ArcGlobe Control

Type t = Type.GetTypeFromProgID("esriFramework.AppRef");
System.Object obj = Activator.CreateInstance(t);

Howevewr, t is coming back as null. Any ideas as to why? I do have the ESRI.ArcGIS.Framework reference in my workspace. I was hoping to access this so I could then use some ArcGlobe Commands via ICommandBar which I wanted to access via

IApplication myApp = obj as IApplication;
ICommandBars myCommandBars = myApplciation.Document.CommandBars;
myCommandItem = commandBars.Find("ID" , false);
myCommandItem.Execute();
share|improve this question
    
Note: I'm not running a full application. I have an ESRI.ArcGIS.Controls.AxGlobeControl stuffed into a User Control. –  PSU_Kardi Nov 22 '10 at 18:12
add comment

1 Answer 1

Note: I am assuming your code runs within the same process as the ArcGlobe application.

If you are running on a 64bit system, try setting your assembly target platform to x86. In VS, you will find this setting under project properties, the "Build" tab, platform target combobox. I have encountered weird COM behavior on 64bit systems, but now I am not able to reproduce the issue on my Win7 64x machine.

Also check the the class and its type library are properly registered. You can inspect windows registry to do so, but if you do not know where to look, your best bet is to run a repair of your ArcGIS installation.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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