Hello-
I am creating an installation dialog with a dynamically populated combobox on it.
On most systems the combo box populates just fine.
I generate a string list of values then:
i=0;
hDatabase = MsiGetActiveDatabase(hMSI);
sQuery = "SELECT * FROM ComboBox WHERE Property='COMBOBOXPROP'";
nResult = MsiDatabaseOpenView(hDatabase, sQuery, hCBOView);
// Allocate space to hold the properties of a combobox row...
hRec = MsiCreateRecord(nCount);
nResult = ListGetFirstString (listIPAddresses, svString);
// Loop while list items continue to be retrieved.
while (nResult != END_OF_LIST)
ret = MsiRecordSetString (hRec, 1, 'COMBOBOXPROP'); // Combobox name. Must be unique with MSI
MsiRecordSetInteger (hRec, 2, i); // 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
ret = MsiViewModify(hCBOView, MSIMODIFY_INSERT_TEMPORARY, hRec);
nResult = ListGetNextString (listIPAddresses, svString);
i++;
endwhile;
// Select the first item in the list as default.
nResult = ListGetFirstString (listIPAddresses, svString);
MsiSetProperty(hMSI, "COMBOBOXPROP", svString);
// Close handles
MsiCloseHandle(hRec);
MsiViewClose (hView);
My problem is that on some systems, the call to MsiViewModify fails with the ever so descriptive error code: ERROR_FUNCTION_FAILED.
Some things I've tried thus far:
I thought that the text I was entering into the value fields was too long so I set the ComboBox Max Length to 256 which should be more than enough. This did not help.
I thought that perhaps the value I was assigning to the position in the call: MsiRecordSetInteger(hRec, 2, i); was incorrect so I started the iterator (i) at 1 rather than 0. This also did not help. However when I add a line to the ComboBox table manually in Installshield, I get an error about putting a zero there so maybe that is part of the problem except it works on many PCs with a 0 iterator start.
An off-hand question about SQL Queries...Does there need to be any SQL database software installed in order for these functions to succeed? I am guessing no since the dependencies for these functions on MSDN is only msi.dll. At this point I feel like no question is a silly question.
I will continue to poke and prod at it but I am running out of ideas. I was hoping someone else could offer some input.
Many thanks.