Friday, October 10, 2008

Get the Product Code of the Installed Product

[Not Sure but can be useful]
Private Function getInstalledProductCode(ByVal InstalledProductNameStr As String) As String
Dim retStr As String = "-1"
Try
Dim installer As Object
installer = CreateObject("WindowsInstaller.Installer")
Dim products As Object = installer.Products
For Each strProductCode As String In products
Dim strProductName As String = installer.ProductInfo(strProductCode, "InstalledProductName")
If strProductName.Contains(InstalledProductNameStr) = True Then
retStr = strProductCode
End If
Next
Catch ex As Exception

End Try
Return retStr
End Function

No comments: