Select to view content in your preferred language

SDK Example doesn't work.

3689
8
12-10-2009 03:16 PM
GregRieck
Frequent Contributor
Hello,
I've been trying to get the Desktop Automation example to work. I'm using the C# 2008 solution.

Here is the exception information:
System.Runtime.InteropServices.COMException was caught
  Message="Retrieving the COM class factory for component with CLSID {006B1AFE-C66C-11D0-B94C-080009EE4E51} failed due to the following error: 80040111."
  Source="DesktopAutomationCS"
  ErrorCode=-2147221231
  StackTrace:
       at DesktopAutomationCS.Form1.btnStartApp_Click(Object sender, EventArgs e) in C:\Program Files\ArcGIS\DeveloperKit9.4\Samples\ArcObjectsNET\DesktopAutomation\CSharp\Form1.cs:line 58
  InnerException:
0 Kudos
8 Replies
RalfGottschalk
Esri Contributor
Hi Grieck,

It looks like that sample is not updated for 9.4.  I was able to get the sample to work by using the ESRI.ArcGIS.VersionManager.LoadVersion method and setting the product code to "Desktop".

ESRI.ArcGIS.VersionManager.LoadVersion(ESRI.ArcGIS.ProductCode.Desktop, "9.4");


Do this in the Main method at the first line.  At 9.4 you need to call LoadVersion for any standalone application before using any ArcObjects.  This is because you can install Engine and Desktop in separate folders.  Using LoadVersion essentially tells the application where to find ArcObjects.

I submitted a bug for you asking to update this sample.  NIM052231.

Thanks for finding that.
0 Kudos
GregRieck
Frequent Contributor
Ralf,

Thanks for the tip that worked great! And thanks for reporting it as a bug.

G
0 Kudos
LukasPlatz
Emerging Contributor
Hi,

I would like to migrate the desktop automatisation code to ArcGIS 10.
I have exchanged the references to v.10 and added ESRI.ArcGIS.CatalogUI

IDocument document = new MxDocumentClass();

Following error arises:
-> Interop Type 'ESRI.ArcGIS.ArcMApUI.MxDocumentClass' cannot be embedded. Use the applicable interface instead.

How can I  create a new instance of IDocument?

Thanks
Stefan
0 Kudos
MichaelBlom
Deactivated User
I too am getting all sorts of errors with the arcgis 10 examples.


The type 'ESRI.ArcGIS.Geodatabase.FieldClass' has no constructors defined

'ESRI.ArcGIS.Geodatabase.FeatureClassDescriptionClass' cannot be embedded. Use the applicable interface instead.
0 Kudos
LakshmananVenkatesan
Frequent Contributor
Change your .NET framework settings in Visual studio. ArcGIS 10 works with .NET 3.5
0 Kudos
kameninestor
Occasional Contributor
Hi,

I have this problem :

Impossible d'effectuer un cast d'un objet COM de type 'ESRI.ArcGIS.ArcMapUI.MxDocumentClass' 
en type d'interface 'ESRI.ArcGIS.Framework.IDocument'. 
Cette opération a échoué, car l'appel QueryInterface sur le composant COM pour l'interface avec 
l'IID '{3E927177-307A-11D2-94C9-080009EEBECB}' a échoué en raison de l'erreur suivante : Le serveur RPC n'est pas disponible. (Exception de HRESULT : 0x800706BA).


In VS 2010.

This is my code :

 Dim objMxDoc As MxDocument
  ...
objMxDoc = New MxDocument


Somebody can help me?

Thanks

--
Nesta
0 Kudos
kameninestor
Occasional Contributor
Pour info,

J'avais en effet trouvé une solution à mon problème en utilisasnt les régistres.

--
Nestasoft
Développeur .NET - Géomatique
0 Kudos
abdallahilemrabott
Emerging Contributor

bonjour

j'ai le meme problme  je voudrais sevoir comment avez vous le resoudre

bien cordielemnt

0 Kudos