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

fill a combo box during installation?


5 replies to this topic

mat

mat
  • Members
  • 5 posts

Posted 14 August 2002 - 13:42

Hello, i have a small problem with the Installshield Developer and I hope that anyone here can help me.
I created a custom dialog with a combo box (also a property for this combo box). Now it is possible to fill this combo box manually with predifined values, but I want to fill this combo box during the installation process.
The problem is that I read out a stringlist at the beginning of the installation, but I can't put these strings into the combo box.
Is there a way to put these strings into this combo box?
Thanks a lot.

Mat

gunavelu

gunavelu
  • Members
  • 23 posts

Posted 16 August 2002 - 12:22

Use the following code. PROPNAME is the property associated with the combo and StringList the List holding the values to be populated.

Code Sample

function PopulateCombo(hMSI)  
   LIST  StringList, DatabaseList;  
   STRING svString;
   NUMBER nResult;  
   NUMBER hDatabase, hCBOView, hView, hRec;
   STRING szText;  
   number index, nCount;
   STRING sQuery;
begin      
index=0;
hDatabase=MsiGetActiveDatabase(hMSI);

sQuery="SELECT * FROM ComboBox WHERE Property='PROPNAME'";
nResult = MsiDatabaseOpenView(hDatabase,sQuery,hCBOView);

// Allocate space to hold the four properties of a combobox row...
hRec=MsiCreateRecord(4);

ServerList = ListCreate (STRINGLIST);
nResult = GetStringList(StringList);
nResult = ListGetFirstString (StringList, svString);                      

MsiRecordSetString(hRec,1,'PROPNAME'); // Combobox name. Must be unique with MSI
MsiRecordSetInteger(hRec,2,index); // Position of the line in the combo
MsiRecordSetString(hRec,3,svString); // Key String - a string related to the line
MsiRecordSetString(hRec,4,svString); //  String to be displayed

MsiViewModify(hCBOView,MSIMODIFY_INSERT_TEMPORARY,hRec);
nResult = ListGetNextString (StringList, svString);

// Loop while list items continue to be retrieved.      
while (nResult != END_OF_LIST)
     // Display the current element.
index=index+1;
MsiRecordSetString(hRec,1,'PROPNAME'); // Combobox name. Must be unique with MSI
MsiRecordSetInteger(hRec,2,index); // Position of the line in the combo
MsiRecordSetString(hRec,3,svString); // Key String - a string related to the line
MsiRecordSetString(hRec,4,svString); //  String to be displayed
// Write the updated row
MsiViewModify(hCBOView,MSIMODIFY_INSERT_TEMPORARY,hRec);  
    nResult = ListGetNextString (StringList, svString);      
endwhile;

// Close handle
MsiCloseHandle(hRec);
MsiViewClose (hView);
end;      

function GetStringList(StringList)
begin
//populate StringList here
end;

Gunavelu

mat

mat
  • Members
  • 5 posts

Posted 19 August 2002 - 10:59

Thanks a lot for your help, gunavelu, it works fine.
Have a good time.

Mat
:D

ShelleyO

ShelleyO
  • Members
  • 8 posts

Posted 13 January 2004 - 10:38

Thanks, this has helped a lot!

daniel.bila

daniel.bila
  • Members
  • 5 posts

Posted 19 January 2004 - 15:54

Does anyone know how to do this but with a VBS ?

I mean, is it possible to update MSI database at runtime in a vbs CustomAction...




Glytzhkof

Glytzhkof
  • Moderators
  • 1,447 posts

Posted 20 January 2004 - 05:56

http://www.installsh...s/msiaccess.asp
Regards
-Stein Åsmul