Show license status
Private Sub ShowLicenseStatus()

' Get license status
    
    Dim numUsed&, maxLicAllowed As Long
    Dim Licenses As String
    Dim idx As Integer
    Dim tagTDAPI_LICENSE_Vals, tagTDAPI_LICENSE_Str
'Set up arrays of constant values and descriptors.
tagTDAPI_LICENSE_Vals = Array(LIC_DEFECT, _
                LIC_TEST_LAB, _
                LIC_REQUIREMENT, _
                LIC_OTA_CLIENT, _
                LIC_COLLABORATION, _
                LIC_DASHBOARD, _
                LIC_COMPONENTS)
                
tagTDAPI_LICENSE_Str = Array("LIC_DEFECT", _
                "LIC_TEST_LAB", _
                "LIC_REQUIREMENT", _
                "LIC_OTA_CLIENT", _
                "LIC_COLLABORATION ", _
                "LIC_DASHBOARD", _
                "LIC_COMPONENTS")

    For idx = LBound(tagTDAPI_LICENSE_Vals) To _
        UBound(tagTDAPI_LICENSE_Vals)
        On Error GoTo InvalidLicenseType
        
        Debug.Print tagTDAPI_LICENSE_Str(idx); _
            tagTDAPI_LICENSE_Vals(idx); _
            "(" & toBin(tagTDAPI_LICENSE_Vals(idx)) & ")"

'Get license status.
        'tdc is the global TDConnection object. To use the GetLicenseStatus
        ' method, you must be connected to a project. For example:
        '         Set tdc = New TDConnection
        '         tdc.InitConnectionEx (qcServerName)
        '         tdc.Login(userName, userPassword)
        '         tdc.Connect(domainName, projectName)
        tdc.GetLicenseStatus tagTDAPI_LICENSE_Vals(idx), numUsed, maxLicAllowed
        Debug.Print "The number used is " & CStr(numUsed)
        Debug.Print "The number licensed is " & CStr(maxLicAllowed)
        
ContinueLoop:
        Debug.Print
    Next idx

Exit Sub

InvalidLicenseType:
        Debug.Print "Show LicenseStatus Error" & vbCrLf & vbTab & err.Description
        
        Debug.Print CStr(tagTDAPI_LICENSE_Vals(idx)) & " is invalid for GetLicenseStatus"
        GoTo ContinueLoop
        
'The output from this procedure on a sample site is:
'LIC_DEFECT 1 (1)
'The number used is 1
'The number licensed is 1
'
'LIC_TEST_LAB 2 (10)
'The number used is 1
'The number licensed is 1
'
'LIC_REQUIREMENT 3 (11)
'The number used is 1
'The number licensed is 1
'
'LIC_OTA_CLIENT 4 (100)
'The number used is 0
'The number licensed is 0
'
'LIC_COLLABORATION  6 (110)
'The number used is 0
'The number licensed is 0
'
'LIC_DASHBOARD 12 (1100)
'The number used is 0
'The number licensed is 0
'
'LIC_COMPONENTS 13 (1101)
'The number used is 1
'The number licensed is 1


End Sub