<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Error when calling IAoInitialize::Initialize in ArcObjects SDK Questions</title>
    <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280282#M7236</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bob,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; It seems that you may need to add code for the new "binding" requirement introduced at the ArcGIS 10.0 level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Briefly, in the C++ environment, ArcGIS 10.0 brings a new requirement for using the IArcGISVersion interface along with its -&amp;gt;LoadVersion() method to bind the application to a specific ArcGIS release level. You will likely also need to add a new #import statement to gain access to the associated ArcGISVersion.dll. A sample code fragment for use with an ArcEngine application is shown below. This binding code now needs to be executed between the call to "::AoInitialize" and the call to "ipInit-&amp;gt;Initialize()".&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;----------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// New for ArcGIS 10.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IArcGISVersionPtr ipVersion(CLSID_VersionManager);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VARIANT_BOOL succeeded;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hr = ipVersion-&amp;gt;LoadVersion(esriArcGISEngine, L"10.0", &amp;amp;succeeded);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;----------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Please see the following forum entry for a code sample, additional discussion, and a link to a new ArcGIS 10.0 Help topic that discusses the need to perform this runtime binding in C++.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/2893-Migrating-standalone-Visual-C-ArcGIS-Engine-applications-to-ArcGIS-10.0"&gt;http://forums.arcgis.com/threads/2893-Migrating-standalone-Visual-C-ArcGIS-Engine-applications-to-ArcGIS-10.0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 31 Aug 2010 13:42:39 GMT</pubDate>
    <dc:creator>ScottKutz</dc:creator>
    <dc:date>2010-08-31T13:42:39Z</dc:date>
    <item>
      <title>Error when calling IAoInitialize::Initialize</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280281#M7235</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I am attempting to get a license using IAoInitialize::Initialize() with ArcGIS 10.&amp;nbsp; The call returns CO_E_APPSINGLEUSE (-2147221002 or 0x800401F6).&amp;nbsp; The computer has a single-use license for ArcEditor, and ArcMap, ArcCatalog, etc. are able to access the license.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Here is the C++ code I am using:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
bool GetALicense()
{
 if (!InitializeLicense(esriLicenseProductCodeEngine))
 {
&amp;nbsp; if (!InitializeLicense(esriLicenseProductCodeArcView))
&amp;nbsp; {
&amp;nbsp;&amp;nbsp; if (!InitializeLicense(esriLicenseProductCodeArcEditor))
&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (!InitializeLicense(esriLicenseProductCodeArcInfo))
&amp;nbsp;&amp;nbsp;&amp;nbsp; {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; wcout &amp;lt;&amp;lt; "License Initialization failed" &amp;lt;&amp;lt; endl; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return false;
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp; }
&amp;nbsp; }
 }

 return true;
}

VARIANT_BOOL InitializeLicense(esriLicenseProductCode product)
{
 IAoInitializePtr ipInit(CLSID_AoInitialize);
 esriLicenseStatus licenseStatus = esriLicenseFailure;
 HRESULT hr = S_OK;

 hr = ipInit-&amp;gt;Initialize(product, &amp;amp;licenseStatus);

 if (FAILED(hr))
 {
&amp;nbsp; wcout &amp;lt;&amp;lt; "Initialize failed, hr=" &amp;lt;&amp;lt; hr &amp;lt;&amp;lt; endl;
 }

 return (licenseStatus == esriLicenseCheckedOut);
}

&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Every call to Initialize() returns the error.&amp;nbsp; This same code works on computers with ArcGIS 9.3 installed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Has anyone else run into this?&amp;nbsp; Were there changes to licensing from ArcGIS 9.3 to ArcGIS 10?&amp;nbsp; The online samples use the same scheme to get a license, and my code is based on one of those samples.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Bob&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 30 Aug 2010 14:53:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280281#M7235</guid>
      <dc:creator>BobCave</dc:creator>
      <dc:date>2010-08-30T14:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Error when calling IAoInitialize::Initialize</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280282#M7236</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Bob,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; It seems that you may need to add code for the new "binding" requirement introduced at the ArcGIS 10.0 level.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Briefly, in the C++ environment, ArcGIS 10.0 brings a new requirement for using the IArcGISVersion interface along with its -&amp;gt;LoadVersion() method to bind the application to a specific ArcGIS release level. You will likely also need to add a new #import statement to gain access to the associated ArcGISVersion.dll. A sample code fragment for use with an ArcEngine application is shown below. This binding code now needs to be executed between the call to "::AoInitialize" and the call to "ipInit-&amp;gt;Initialize()".&amp;nbsp;&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;----------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;// New for ArcGIS 10.0&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;IArcGISVersionPtr ipVersion(CLSID_VersionManager);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;VARIANT_BOOL succeeded;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hr = ipVersion-&amp;gt;LoadVersion(esriArcGISEngine, L"10.0", &amp;amp;succeeded);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;----------------------------&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; Please see the following forum entry for a code sample, additional discussion, and a link to a new ArcGIS 10.0 Help topic that discusses the need to perform this runtime binding in C++.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.arcgis.com/threads/2893-Migrating-standalone-Visual-C-ArcGIS-Engine-applications-to-ArcGIS-10.0"&gt;http://forums.arcgis.com/threads/2893-Migrating-standalone-Visual-C-ArcGIS-Engine-applications-to-ArcGIS-10.0&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; I hope this helps.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Scott&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Aug 2010 13:42:39 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280282#M7236</guid>
      <dc:creator>ScottKutz</dc:creator>
      <dc:date>2010-08-31T13:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error when calling IAoInitialize::Initialize</title>
      <link>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280283#M7237</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Thanks, Scott.&amp;nbsp; I have a couple of additional questions, so I posted them on the other thread to try to keep the discussion in one place.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 31 Aug 2010 14:54:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcobjects-sdk-questions/error-when-calling-iaoinitialize-initialize/m-p/280283#M7237</guid>
      <dc:creator>BobCave</dc:creator>
      <dc:date>2010-08-31T14:54:32Z</dc:date>
    </item>
  </channel>
</rss>

