AE初始化liscence

[C#]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using ESRI.ArcGIS.esriSystem;

namespace GlobeCtrMouseAndKey
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            AoInitialize AoInit = new AoInitialize();
            AoInit.Initialize(esriLicenseProductCode.esriLicenseProductCodeEngine);
            esriLicenseStatus licenseStatus = AoInit.IsProductCodeAvailable(esriLicenseProductCode.esriLicenseProductCodeEngine);
            if (licenseStatus != esriLicenseStatus.esriLicenseAvailable)
            {
                System.Diagnostics.Trace.WriteLine("Invalid Licensing.");
                return;
            }
            Application.Run(new Form1());

            AoInit.Shutdown();
        }
    }
}
[C++ Qt]
#pragma warning(disable:4819)
#include <ArcSDK.h>
#include <Ao/AoControls.h> // Controls

#include <QtGui/QApplication>
#include <QtCore/QTextCodec>
#include "QAEGlobeControl.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);

    // Initialize the Engine
    ::AoInitialize(NULL);
    {
        IAoInitializePtr ipInit(CLSID_AoInitialize);
        esriLicenseStatus status;
        ipInit->Initialize(esriLicenseProductCodeEngine, &status);
        if (status != esriLicenseCheckedOut)
        {
            printf("Invalid Licensing.\n");
            AoExit(0);
        }
    }        

    QAEGlobeControl w;
    w.resize(1000,618);
    w.show();
    a.exec();

    // Uninitialize the engine
    IAoInitializePtr ipInit(CLSID_AoInitialize);
    ipInit->Shutdown();
    ::AoUninitialize();

    AoExit(0);
}

你可能感兴趣的:(AE初始化liscence)