⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 EVC4.rar
💻 FRM
📖 第 1 页 / 共 2 页
字号:
                If pkgCatNode Is Nothing Then
                    Exit Do
                End If
                If (StrComp(pkgCatNode.Text, tPackageFile.KeyName) = 0) Then
                    Exit Do
                End If
                Set pkgCatNode = pkgCatNode.Next
            Loop
            If (pkgCatNode Is Nothing) Then
                'we did not find a match; so create a file grouping with the key name
                Set pkgCatNode = tvwItems.Nodes.Add(pkgNode.Key, tvwChild, "DPG" & CStr(nKey), tPackageFile.KeyName)
                nKey = nKey + 1
            End If
            
            ' get the next element and add it to the tree
            Set pkgFileNode = tvwItems.Nodes.Add(pkgCatNode.Key, tvwChild, "DPG" & CStr(nKey), tPackageFile.Name)
            nKey = nKey + 1
                        
            ' set the file properties
            Set pkgFilePropNode = tvwItems.Nodes.Add(pkgFileNode.Key, tvwChild, "DPG" & CStr(nKey), "OS: " & tPackageFile.MajorVersion & "." & tPackageFile.MinorVersion)
            nKey = nKey + 1
            Set pkgFilePropNode = tvwItems.Nodes.Add(pkgFileNode.Key, tvwChild, "DPG" & CStr(nKey), "File Info: Locale(" & tPackageFile.Locale & "), Flags(" & tPackageFile.Flags & ")")
            nKey = nKey + 1
            Set pkgFilePropNode = tvwItems.Nodes.Add(pkgFileNode.Key, tvwChild, "DPG" & CStr(nKey), "CPU: Type(" & tPackageFile.Type & "), PageSize(" & tPackageFile.PageSize & "), Level(" & tPackageFile.Level & "), Architecture(" & tPackageFile.Architecture & ")")
            nKey = nKey + 1

        Next tPackageFile
                        
    Next tPackage
    Exit Sub
    
DisplayError:
    Debug.Assert False
    If (Err.Number <> 0) Then
        ShowError "DisplayPackages"
    End If
    
End Sub

Sub DisplayOSs(tEnumObjects As Object, tRootNode As Node, nKey As Integer)
    
    If tEnumObjects.Count = 0 Then
        Exit Sub
    End If

    Dim osNode As Node, ossNode As Node, osPropNode As Node
    Dim tOS As Object
    
    On Error GoTo DisplayError
    
    ' create the root OSs node
    Set ossNode = tvwItems.Nodes.Add(tRootNode.Key, tvwChild, "DOSS" & CStr(nKey), "OSs")
    nKey = nKey + 1

    ' display the enumeration of OS
    For Each tOS In tEnumObjects
    
        ' add the os node
        Set osNode = tvwItems.Nodes.Add(ossNode.Key, tvwChild, "DOSS" & CStr(nKey), tOS.Name)
        nKey = nKey + 1
        
        ' add the properties of this os node
        Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOSS" & CStr(nKey), "Id: " & tOS.Id)
        nKey = nKey + 1
        Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOSS" & CStr(nKey), "TypeId: " & tOS.TypeId)
        nKey = nKey + 1
        Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOSS" & CStr(nKey), "Major: " & tOS.MajorVersion)
        nKey = nKey + 1
        Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOSS" & CStr(nKey), "Minor: " & tOS.MinorVersion)
        nKey = nKey + 1
    
    Next tOS
    Exit Sub
    
DisplayError:
    Debug.Assert False
    If (Err.Number <> 0) Then
        ShowError "DisplayOSs"
    End If
    
End Sub

Sub DisplayOS(tOS As Object, tRootNode As Node, nKey As Integer)
    
    Dim osNode As Node, ossNode As Node, osPropNode As Node
    
    On Error GoTo DisplayError
    
    ' create the root OS node
    Set ossNode = tvwItems.Nodes.Add(tRootNode.Key, tvwChild, "DOS" & CStr(nKey), "OS")
    nKey = nKey + 1
    
    ' add the os node
    Set osNode = tvwItems.Nodes.Add(ossNode.Key, tvwChild, "DOS" & CStr(nKey), tOS.Name)
    nKey = nKey + 1
    
    ' add the properties of this os node
    Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOS" & CStr(nKey), "Id: " & tOS.Id)
    nKey = nKey + 1
    Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOS" & CStr(nKey), "TypeId: " & tOS.TypeId)
    nKey = nKey + 1
    Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOS" & CStr(nKey), "Major: " & tOS.MajorVersion)
    nKey = nKey + 1
    Set osPropNode = tvwItems.Nodes.Add(osNode.Key, tvwChild, "DOS" & CStr(nKey), "Minor: " & tOS.MinorVersion)
    nKey = nKey + 1
    Exit Sub
    
DisplayError:
    Debug.Assert False
    If (Err.Number <> 0) Then
        ShowError "DisplayOS"
    End If
    
End Sub

Sub DisplayPlatforms(tEnumObjects As Object, tRootNode As Node, nKey As Integer)
    
    If tEnumObjects.Count = 0 Then
        Exit Sub
    End If

    Dim platformNode As Node, platformsNode As Node
    Dim tPlatform As Object
    
    On Error GoTo DisplayError
    
    ' create the root platforms node
    Set platformsNode = tvwItems.Nodes.Add(tRootNode.Key, tvwChild, "DPL" & CStr(nKey), "Platforms")
    nKey = nKey + 1

    ' display the platforms
    For Each tPlatform In tEnumObjects
    
        ' get the next element and add it to the tree
        Set platformNode = tvwItems.Nodes.Add(platformsNode.Key, tvwChild, "DPL" & CStr(nKey), tPlatform.Name)
        nKey = nKey + 1
                
        ' display the packages
        DisplayPackages tPlatform.EnumPackages, platformNode, nKey
        
        ' display the os
        DisplayOS tPlatform.GetOS, platformNode, nKey

        ' display the enumeration of transports
        DisplayTransports tPlatform.EnumTransports, platformNode, nKey

        ' display the enumeration of cpus
        DisplayCPUs tPlatform.EnumCPUs, platformNode, nKey

        ' display the enumeration of startup servers
        DisplayStartupServers tPlatform.EnumStartupServers, platformNode, nKey

        ' display the enumeration of devices
        DisplayDevices tPlatform, tPlatform.EnumDevices, platformNode, nKey
                        
        ' display the properties of platform
        DisplayProperties tPlatform.EnumProperties, platformNode, nKey
        
    Next tPlatform
    Exit Sub
    
DisplayError:
    Debug.Assert False
    If (Err.Number <> 0) Then
        ShowError "DisplayPlatforms"
    End If
    
End Sub

Sub DisplayServiceCategories(tEnumObjects As Object, tRootNode As Node, nKey As Integer)
    
    If tEnumObjects.Count = 0 Then
        Exit Sub
    End If

    Dim serviceCategoryNode As Node, serviceCategoriesNode As Node, serviceCategoryPropNode As Node
    Dim tServiceCategory As Object
    
    On Error GoTo DisplayError
    
    ' create the root platforms node
    Set serviceCategoriesNode = tvwItems.Nodes.Add(tRootNode.Key, tvwChild, "DSC" & CStr(nKey), "ServiceCategories")
    nKey = nKey + 1

    ' display the service categories
    For Each tServiceCategory In tEnumObjects
    
        ' get the next element and add it to the tree
        Set serviceCategoryNode = tvwItems.Nodes.Add(serviceCategoriesNode.Key, tvwChild, "DPL" & CStr(nKey), tServiceCategory.Name)
        nKey = nKey + 1
                
        Set serviceCategoryPropNode = tvwItems.Nodes.Add(serviceCategoryNode.Key, tvwChild, "DPL" & CStr(nKey), tServiceCategory.Id)
        nKey = nKey + 1
       
        ' display the enumeration of service infos
        DisplayServiceInfos tServiceCategory.EnumServiceInfos, serviceCategoryNode, nKey
                        
        ' display the properties of service category
        DisplayProperties tServiceCategory.EnumProperties, serviceCategoryNode, nKey
        
    Next tServiceCategory
    Exit Sub
    
DisplayError:
    Debug.Assert False
    If (Err.Number <> 0) Then
        ShowError "DisplayServiceCategories"
    End If
    
End Sub

Sub DisplayServiceInfos(tEnumObjects As Object, tRootNode As Node, nKey As Integer)
    
    If tEnumObjects.Count = 0 Then
        Exit Sub
    End If

    Dim serviceInfoNode As Node, serviceInfosNode As Node, serviceInfoPropNode As Node
    Dim tServiceInfo As Object
    
    On Error GoTo DisplayError
    
    ' create the root platforms node
    Set serviceInfosNode = tvwItems.Nodes.Add(tRootNode.Key, tvwChild, "DSI" & CStr(nKey), "ServiceInfos")
    nKey = nKey + 1

    ' display the service categories
    For Each tServiceInfo In tEnumObjects
    
        ' get the next element and add it to the tree
        Set serviceInfoNode = tvwItems.Nodes.Add(serviceInfosNode.Key, tvwChild, "DPL" & CStr(nKey), tServiceInfo.Name)
        nKey = nKey + 1
                                        
        Set serviceInfoPropNode = tvwItems.Nodes.Add(serviceInfoNode.Key, tvwChild, "DPL" & CStr(nKey), tServiceInfo.Id)
        nKey = nKey + 1
                                
        ' display the properties of service info
        DisplayProperties tServiceInfo.EnumProperties, serviceInfoNode, nKey
        
    Next tServiceInfo
    Exit Sub
    
DisplayError:
    Debug.Assert False
    If (Err.Number <> 0) Then
        ShowError "DisplayServiceInfos"
    End If
    
End Sub

Private Sub Form_Load()
            
    ' unique key for each tree node
    Dim nKey As Integer
    
    On Error GoTo DisplayError
    
    ' add the platform manager node
    Dim rootNode As Node
    Set rootNode = tvwItems.Nodes.Add(, , "Root Node", "Platform Manager")
    nKey = 1

    ' create the platman
    Dim tPlatman As Object
    Set tPlatman = CreateObject("PlatformManager.PlatformManager.1")

    ' display enumeration of Packages
    DisplayPackages tPlatman.EnumPackages, rootNode, nKey

    ' display enumeration of OSs
    DisplayOSs tPlatman.EnumOSs, rootNode, nKey
    
    ' display enumeration of bootable devices
    DisplayBootableDevices tPlatman.EnumBootableDevices, rootNode, nKey
    
    ' display enumeration of service categories
    DisplayServiceCategories tPlatman.EnumServiceCategories, rootNode, nKey

    ' display enumeration of cpus
    DisplayCPUs tPlatman.EnumCPUs, rootNode, nKey

    ' display enumeration of platforms
    DisplayPlatforms tPlatman.EnumPlatforms, rootNode, nKey
    
    ' display enumeration of properties of platman
    DisplayProperties tPlatman.EnumProperties, rootNode, nKey
      
    ' release the reference to platman object
    Set tPlatman = Nothing
    
    'if there is atleast one item, expand the root node
    If tvwItems.Nodes.Count > 0 Then
        If tvwItems.Nodes(1).Children > 0 Then
            tvwItems.Nodes(1).Child.EnsureVisible
        End If
    End If
    Exit Sub
    
DisplayError:
    Debug.Assert False
    Set tPlatman = Nothing
    If (Err.Number <> 0) Then
        ShowError "Form_Load"
    End If

End Sub

Private Sub Form_Resize()
    
    If WindowState <> vbMinimized Then
        If Me.Height > (2 * tvwItems.Top + 420) Then
            tvwItems.Height = Me.Height - (2 * tvwItems.Top + 400 + 40)
        End If
        If Me.Width > (2 * tvwItems.Left + 160) Then
            tvwItems.Width = Me.Width - (2 * tvwItems.Left + 160)
        End If
    End If
    
End Sub

Sub ShowError(ByVal sMsg$)

    ' display the error
    Dim sRtrnCode As String
    Dim lRet As Long
    Dim MessageText As String
    
    sRtrnCode = Space$(256)
    lRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0&, Err.Number, 0&, _
              sRtrnCode, 256&, 0&)
    If lRet > 0 Then
       MessageText = MessageText & Chr(10) & "Error in: " & sMsg$ & " ; Code: " & Hex(Err.Number) & " Message: " & Left(sRtrnCode, lRet)
    Else
        MessageText = Err.Description
    End If
    MsgBox MessageText
    Screen.MousePointer = vbDefault
    
    Err.Clear
    
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -