I am attempting to get a license using IAoInitialize::Initialize() with ArcGIS 10. The call returns CO_E_APPSINGLEUSE (-2147221002 or 0x800401F6). The computer has a single-use license for ArcEditor, and ArcMap, ArcCatalog, etc. are able to access the license. Here is the C++ code I am using:
bool GetALicense()
{
if (!InitializeLicense(esriLicenseProductCodeEngine))
{
if (!InitializeLicense(esriLicenseProductCodeArcView))
{
if (!InitializeLicense(esriLicenseProductCodeArcEditor))
{
if (!InitializeLicense(esriLicenseProductCodeArcInfo))
{
wcout << "License Initialization failed" << endl;
return false;
}
}
}
}
return true;
}
VARIANT_BOOL InitializeLicense(esriLicenseProductCode product)
{
IAoInitializePtr ipInit(CLSID_AoInitialize);
esriLicenseStatus licenseStatus = esriLicenseFailure;
HRESULT hr = S_OK;
hr = ipInit->Initialize(product, &licenseStatus);
if (FAILED(hr))
{
wcout << "Initialize failed, hr=" << hr << endl;
}
return (licenseStatus == esriLicenseCheckedOut);
}
Every call to Initialize() returns the error. This same code works on computers with ArcGIS 9.3 installed.Has anyone else run into this? Were there changes to licensing from ArcGIS 9.3 to ArcGIS 10? The online samples use the same scheme to get a license, and my code is based on one of those samples.Thanks,Bob