例子1

以下示例子程序利用 AttributeValue 显示所有模块的列表,内容包括每个模块的类型、流程页(Section)以及运行状态。

Sub ListBlocksExample(ByVal ihAPSim As Happ.IHapp)
' 本示例演示如何获取模块列表及其属性
Dim ihBlockList As Happ.IHNodeCol
Dim ihBlock As Happ.IHNode
Dim strOut As String
On Error GoTo ErrorHandler

ihBlockList = ihAPSim.Tree.Data.Blocks.Elements
strOut = "Block" & Chr(9) & "Type" & Chr(9) & "Section " & Chr(9) & "Results status"
For Each ihBlock In ihBlockList
 strOut = strOut & Chr(13) & ihBlock.Name & Chr(9) & _
   ihBlock.AttributeValue(Happ.HAPAttributeNumber.HAP_RECORDTYPE) & _
   " " & Chr(9) & _
   ihBlock.AttributeValue(Happ.HAPAttributeNumber.HAP_SECTION) & Chr(9) & _
   Status(ihBlock.AttributeValue(Happ.HAPAttributeNumber.HAP_COMPSTATUS))
Next ihBlock
MsgBox(strOut, , "ListBlocksExample")
Exit Sub
ErrorHandler:
MsgBox("ListBlocksExample raised error" & Err.Description)
End Sub