Windows Installer API (SDK)

Property Table

Referenz » Property Table | Microsoft Docs


VBS class Property


Class classPropertyTable
Private mProperty, mValue

    Public Property Get pProperty
        pProperty = mProperty
    End Property
    Public Property Let pProperty(strProperty)
        mProperty = strProperty
    End Property
    Public Property Get pValue
        pValue = mValue
    End Property
    Public Property Let pValue(strValue)
        mValue = strValue
    End Property
    
    Private Sub Class_Initialize
        'Anweisungen
    End Sub
    ' -----------------------------------------------------------------
    
    Public Function ModifyPropertyRecord()
    Dim strSQL, objView, objTableRow

    strSQL = "SELECT * FROM Property"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    Do 
        Set objTableRow = objView.Fetch
        If objTableRow Is Nothing Then Exit Do
        
        objTableRow.StringData(1) = mProperty
        objTableRow.StringData(2) = mValue
        objView.Modify msiViewModifyAssign, objTableRow

    Loop
    objDatabase.Commit()
    objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function GetPropertyValue(strPropertyName)
    Dim strSQL, objView, objTableRow

    strSQL = "SELECT * FROM Property"

    Set objView = objDatabase.OpenView(strSQL)
    objView.Execute
    Do 
        Set objTableRow = objView.Fetch
        If objTableRow Is Nothing Then Exit Do
        
        If objTableRow.StringData(1) = strPropertyName Then _
            GetPropertyValue = objTableRow.StringData(2)
        
    Loop
    objView.Close
    Set objView = Nothing

    End Function
    ' -----------------------------------------------------------------

    Public Function ExecuteRequest(strKey, strValue)
    Dim tmpStr
    
        mProperty = strKey
        mValue = strValue

        If strKey = "SecureCustomProperties" Then
            tmpStr = GetPropertyValue("SecureCustomProperties")
            If tmpStr <> "" Then
                mValue = tmpStr & ";" & strValue
            Else
                mValue = strValue
            End If
        End If

        If strKey = "MsiHiddenProperties" Then
            tmpStr = GetPropertyValue("MsiHiddenProperties")
            If tmpStr <> "" Then
                mValue = tmpStr & ";" & strValue
            Else
                mValue = strValue
            End If
        End If

            ModifyPropertyRecord

        If strKey = "ARPPRODUCTICON" Then
            msiIcon.pName = strValue
            msiIcon.pData = PathOfIcon & strValue
                msiIcon.ModifyIconTable
        End If

        tmpStr = ""
        mProperty = ""
        mValue = ""

    End Function
    ' -----------------------------------------------------------------

    Private Sub Class_Terminate()
        'Anweisungen
    End Sub
End Class
' ---------------------------------------------------------------------