Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Dynamic ListBox/ComboBox


2 replies to this topic

mishka

mishka
  • Full Members
  • 21 posts

Posted 13 May 2004 - 07:35

I need to create a dialog for a CA that will
display list of domains (as it appears in Network
Neighborhood) and get user choice.

Now the questions:

1. I suppose I have to create a CA that will call a function
from DLL that will prepare list of avaialble domains.
How can I transfer this list to some MSI table ?

2. How can I tell to my ListBox or ComboBox in the
next CA to take above list as available choices ?


Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 13 May 2004 - 15:16

Your custom action would add temporary rows to the ComboBox (or ListBox) table. Your control will then automatically display these entries.

saeta119

saeta119
  • Members
  • 3 posts

Posted 14 May 2004 - 22:13

using a vbscript CA this is how I populate a combobox with a list of available SQL servers.

'================================================
' Function: Populates a combobox with a list of available SQL Servers
'================================================

Function PropDisplay( )
on error resume next
' open and execute a view to the ListBox table
Set x = CreateObject("WScript.Shell")
Set viewlist = Database.OpenView("SELECT * FROM `ComboBox` WHERE `Property`='CMBDATABASESELECTION'")
viewlist.Execute

'+++++++++++++++++++++++++++++++
zz = x.RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\InstalledInstances")
computername = x.RegRead("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName")
if isarray(zz) then
for r = 0 to ubound(zz)
'LoadOption(zz(i))
'msgbox zz®
' ListBox record fields are Property, Order, Value, Text
Set reclist = Installer.CreateRecord(4)
if r=0 then
reclist.StringData(1) = "CMBDATABASESELECTION"
reclist.IntegerData(2) = r
reclist.StringData(3) = "(LOCAL)"
reclist.StringData(4) = "(LOCAL)"
else

reclist.StringData(1) = "CMBDATABASESELECTION"
reclist.IntegerData(2) = r
reclist.StringData(3) = computername & "\" & zz®
reclist.StringData(4) = computername & "\" & zz®
end if
' insert the temporary ListBox record
viewlist.Modify msiViewModifyInsertTemporary, reclist
next
Session.Property("SQLSUCCESS")="1"
end if
'+++++++++++++++++++++++++++++++

if ubound(zz)<0 then
'Do not allow user to go to the next dialog.
Session.Property("SQLSUCCESS")="0"
msgbox "Unable to find SQL Servers on local machine, you need to have an available SQL Server to install this application as a Server or Both Workstation and Server",,""
end if
viewlist.Close

' return success to MSI
PropDisplay = IDOK
End Function