AoInitailize 权限

转载 2007年09月25日 15:56:00
[Visual Basic 6.0]
Option Explicit
Private m_pAoInitialize As IAoInitialize

Private Sub Form_Load()
  'This sample is designed to perform license initialization on a system
  'that may have access to a floating license. It requires GDB editing
  'capability and A spatial Analyst extension
  
  'This sample will check the required licenses and keep them checked out
  Dim licenseStatus As esriLicenseStatus
  'First try copy protection EngineGeoDB
  licenseStatus = CheckOutLicenses(esriLicenseProductCodeEngineGeoDB)
  If (licenseStatus = esriLicenseNotLicensed) Then
    'Next try Desktop ArcEngine
    licenseStatus = CheckOutLicenses(esriLicenseProductCodeArcEditor)
    'For Desktop licenses we also need to consider them being unavailable
    If ((licenseStatus = esriLicenseNotLicensed) Or (licenseStatus = esriLicenseUnavailable)) Then
      'Last try Desktop ArcInfo
      licenseStatus = CheckOutLicenses(esriLicenseProductCodeArcInfo)
    End If
  End If
  
  'Take a look at the licenseStatus to see if it failed
  'Not licensed
  If (licenseStatus = esriLicenseNotLicensed) Then
    MsgBox "You are not licensed to run this product"
    Unload Form1
  'The licenses needed are currently in use
  ElseIf (licenseStatus = esriLicenseUnavailable) Then
    MsgBox "There are insufient licenses to run"
    Unload Form1
  'The licenses unexpected license failure
  ElseIf (licenseStatus = esriLicenseFailure) Then
    MsgBox "Unexpected license failure please contact you administrator'"
    Unload Form1
  'Already initialized (Initialization can only occur once)
  ElseIf (licenseStatus = esriLicenseAlreadyInitialized) Then
    MsgBox "You license has already been initialized please check you implementation"
    Unload Form1
  'Everything was checkedout successfully
  ElseIf (licenseStatus = esriLicenseCheckedOut) Then
    MsgBox "Licenses checked out successfully"
  End If
  
End Sub

Private Sub Form_Unload(Cancel As Integer)

  'Checkin the extension
  m_pAoInitialize.CheckInExtension (esriLicenseExtensionCodeSpatialAnalyst)
  'Shutdown
  m_pAoInitialize.Shutdown

End Sub

Private Function CheckOutLicenses(productCode As esriLicenseProductCode) As esriLicenseStatus
  
  Dim licenseStatus As esriLicenseStatus
  Set m_pAoInitialize = New AoInitialize
  CheckOutLicenses = esriLicenseUnavailable
    
  'Check the productCode
  licenseStatus = m_pAoInitialize.IsProductCodeAvailable(productCode)
  If (licenseStatus = esriLicenseAvailable) Then
    'Check the extensionCode
    licenseStatus = m_pAoInitialize.IsExtensionCodeAvailable(productCode, esriLicenseExtensionCodeSpatialAnalyst)
    If (licenseStatus = esriLicenseAvailable) Then
      'Initialize the license
      licenseStatus = m_pAoInitialize.Initialize(productCode)
      If (licenseStatus = esriLicenseCheckedOut) Then
          'Checkout the extension
        licenseStatus = m_pAoInitialize.CheckOutExtension(esriLicenseExtensionCodeSpatialAnalyst)
      End If
    End If
  End If
  
  CheckOutLicenses = licenseStatus
  
End Function
 

相关文章推荐

ROOT权限设置

  • 2017年11月09日 10:13
  • 67KB
  • 下载

shiro 权限认证的原理,个人的理解

1.对有没有访问权限的理解。 我们看shiro的配置文件,所以的请求都是需要用户登录的 因而用户 在登录成功时候,shiro已经把该用户是否有访问某一url的权限已经判断好了。 看下面简单的代码 ...
  • baicp3
  • baicp3
  • 2015年05月22日 09:49
  • 11092

权限管理系统

  • 2017年08月28日 14:57
  • 5.32MB
  • 下载

linux用户管理(2)----修改用户模式(usermod,sudo权限等)

修改使用者模式可以使用usermod命令实现。 一、usermod常用命令介绍: -a:              仅和-G一块使用,将用户添加到附属组群。 -d:   ...

C#权限及审核

  • 2017年11月01日 11:43
  • 2KB
  • 下载

MySQL 安装 (不需root权限的安装方法)

在一台服务器上安装多个Mysql,每个帐号可以有,也可以没有。而且一个帐号可以安装多个Mysql。但帐号没有root权限,不能使用软件包来安装(需要root权限) 方法: 在http:...
  • lmm2003
  • lmm2003
  • 2011年10月28日 23:31
  • 4940

Android权限申请示例

  • 2017年10月30日 16:15
  • 19.03MB
  • 下载
内容举报
返回顶部
收藏助手
不良信息举报
您举报文章:AoInitailize 权限
举报原因:
原因补充:

(最多只允许输入30个字)