This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Add Item to ComboBox
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 16, 2007
05:52 AM
Add Item to ComboBox
The function PopulateComboBox add items in a combo box.
The row in red returns error 1627 (ERROR_FUNCTION_FAILED).
I call the function PopulateComboBox on button click in a dialog
In the same dialog there is a combo box with the property = PROP_COMBO
(The project is Basic MSI)
Thanks!!
function PopulateComboBox(hInstall)
NUMBER nResult, hDatabase, hCboView, index;
STRING sQuery;
begin
hDatabase = MsiGetActiveDatabase(hInstall);
sQuery = "SELECT * FROM ComboBox WHERE Property='PROP_COMBO'";
nResult = MsiDatabaseOpenView(hDatabase, sQuery, hCboView);
if (nResult = ERROR_SUCCESS) then
AddCboEntry(hCboView, "PROP_COMBO", "United States", "United States", 1);
AddCboEntry(hCboView, "PROP_COMBO", "Canada", "Canada", 2);
AddCboEntry(hCboView, "PROP_COMBO", "Mexico", "Mexico", 3);
AddCboEntry(hCboView, "PROP_COMBO", "Puerto Rico", "Puerto Rico", 4);
endif;
MsiViewClose(hCboView);
end;
function AddCboEntry(hView, szProperty, szText, szValue, nIndex)
NUMBER hRec;
NUMBER res;
begin
hRec = MsiCreateRecord(4);
res = MsiRecordSetString(hRec, 1, szProperty);
res = MsiRecordSetInteger(hRec, 2, nIndex);
res = MsiRecordSetString(hRec, 3, szText);
res = MsiRecordSetString(hRec, 4, szValue);
res = MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRec);
MsiCloseHandle(hRec);
end;
The row in red returns error 1627 (ERROR_FUNCTION_FAILED).
I call the function PopulateComboBox on button click in a dialog
In the same dialog there is a combo box with the property = PROP_COMBO
(The project is Basic MSI)
Thanks!!
function PopulateComboBox(hInstall)
NUMBER nResult, hDatabase, hCboView, index;
STRING sQuery;
begin
hDatabase = MsiGetActiveDatabase(hInstall);
sQuery = "SELECT * FROM ComboBox WHERE Property='PROP_COMBO'";
nResult = MsiDatabaseOpenView(hDatabase, sQuery, hCboView);
if (nResult = ERROR_SUCCESS) then
AddCboEntry(hCboView, "PROP_COMBO", "United States", "United States", 1);
AddCboEntry(hCboView, "PROP_COMBO", "Canada", "Canada", 2);
AddCboEntry(hCboView, "PROP_COMBO", "Mexico", "Mexico", 3);
AddCboEntry(hCboView, "PROP_COMBO", "Puerto Rico", "Puerto Rico", 4);
endif;
MsiViewClose(hCboView);
end;
function AddCboEntry(hView, szProperty, szText, szValue, nIndex)
NUMBER hRec;
NUMBER res;
begin
hRec = MsiCreateRecord(4);
res = MsiRecordSetString(hRec, 1, szProperty);
res = MsiRecordSetInteger(hRec, 2, nIndex);
res = MsiRecordSetString(hRec, 3, szText);
res = MsiRecordSetString(hRec, 4, szValue);
res = MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRec);
MsiCloseHandle(hRec);
end;
(2) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 16, 2007
08:34 AM
Perhaps try executing the view (with MsiViewExecute) after calling MsiDatabaseOpenView? If you haven't yet, perhaps also see the InstallScript help topic "Windows Installer API Functions Example" and this newsletter tip (PDF warning): http://www.macrovision.com/webdocuments/PDF/msiaccess.pdf?link_id=community.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Mar 11, 2008
10:41 PM
fyi, the code above worked for me, didnt have to change anything. (thanks)