For example, I'm trying to get a program (in VB) to report all Merge Modules with a Custom Action in the install sequence starting with "IS" - the only controls on my dialog are List1 and Command1:
Code Sample |
Private Sub Command1_Click() Dim wi As Installer Set wi = CreateObject("WindowsInstaller.Installer") Dim fso As New FileSystemObject Dim fo As folder Set fo = fso.GetFolder("E:\Modules") Dim fi As File For Each fi In fo.Files Dim db As Database Set db = wi.OpenDatabase(fi.Path, WindowsInstaller.msiOpenDatabaseModeReadOnly) Dim vw As View Set vw = db.OpenView("SELECT * FROM ModuleInstallExecuteSequence") vw.Execute Dim rd As Record Set rd = vw.Fetch While Not rd Is Nothing If Left(rd.StringData(1), 2) = "IS" Then List1.AddItem (fi.Name & ": " & rd.StringData(1)) End If Set rd = vw.Fetch Wend vw.Close Next End Sub |
If any one of these modules doesn't have a ModuleInstallExecuteSequence, then I get a message box saying
Run-time error '-2147467259 (80004005)'
OpenView,Sql
This obviously means "I can't run that select statement." but it's failing on the actual "Set vw = db.OpenView(...)" line, so there doesn't seem to be a way of trapping it and saying to the automation DLL "Look, if there's no table then you don't have any records, so I don't care!"
Any ideas anyone? Please??!?