One of the arcobjects-initialization license

Source: Internet
Author: User
Tags visual studio 2010

Arcobjects is the underlying API for ArcGIS, built on COM technology, so it can naturally support C++,VB. NET, and many other languages. However, because it is COM based, its APIs are difficult to use (as compared to the. Net framework). I've been using it for some time, but I've always had some annoying little problems with it. In that case, write them down and share them with us.

The system environment I use is Windows 7 64-bit, Visual Studio 2010, and ArcGIS 9.3/10.
Of course, for projects that use Arcobjects, first set the build target platform for X86in the project properties (taking into account the 64-bit development environment and the operating environment).

Visual Studio 2010 references to all arcobjects have the default set of embedded interop types: True,
So you don't see the-class suffix behind the component class in my Code.


Please use Visual Studio 2008 or later to add the-class suffix to your classmates.

Before invoking the other Arcobjects APIs, you first have to initialize the license:

Using System;
Using ESRI. Arcgis.esrisystem; ESRI. ArcGIS.System.dll
//using ESRI. arcgis.version;

Omitting several lines of

static void Initialize ()
{
    //ARCGIS10 requires binding product code
    //runtimemanager.bind ( Productcode.engineordesktop);

    Initialize AO license
    var aoi = new Aoinitialize ();
    var s = Aoi. Initialize (
        esrilicenseproductcode.esrilicenseproductcodeenginegeodb);

    if (s = = esrilicensestatus.esrilicenseunavailable)
        throw new NotSupportedException ("requested permission not available");
}

ArcGIS 10 has a new Runtimemanger(included in the ESRI.ArcGIS.Version, this DLL is also new), before initializing AO must call its Bind method, bind the corresponding product.

In addition,Esrilicenseproductcode is generally set to engine, when you need to visit Geodatabase, you have to set Enginegeodb (of course, if you have the license of the GEODB).

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.