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
- :
- Re: How to read feature table from direct editor
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
‎Jul 23, 2009
09:54 AM
How to read feature table from direct editor
Hi
How can I read the feature names from the direct editor?
I use an InstallScript MSI Project.
I don't know how to use MsiGetActiveDatabase(); and the other Msi-Commands... I hope you can help me. Thanks
Regards
Blueeberry
How can I read the feature names from the direct editor?
I use an InstallScript MSI Project.
I don't know how to use MsiGetActiveDatabase(); and the other Msi-Commands... I hope you can help me. Thanks
Regards
Blueeberry
(3) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 27, 2009
05:49 PM
For InstallScript MSI, perhaps look into using FeatureListItems to list features, and FeatureGetData for other information?
For general MSI information, perhaps see this old newsletter tip (PDF): http://www.acresso.com/webdocuments/PDF/msiaccess.pdf. Also see the InstallShield topic "Windows Installer API Functions Example" for an InstallScript version of one of the examples.
For general MSI information, perhaps see this old newsletter tip (PDF): http://www.acresso.com/webdocuments/PDF/msiaccess.pdf. Also see the InstallShield topic "Windows Installer API Functions Example" for an InstallScript version of one of the examples.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jul 28, 2009
03:32 AM
Hi Robert
I found a way to read it from the Feature Table...
Thank you for you answer.
regards
Blueeberry
I found a way to read it from the Feature Table...
Thank you for you answer.
hActiveDB = MsiGetActiveDatabase(ISMSI_HANDLE);
nResult = MsiDatabaseOpenView(hActiveDB, "SELECT Feature FROM Feature", phView);
if (nResult = ERROR_SUCCESS) then
nResult = MsiViewExecute(phView, 0);
if(nResult = ERROR_SUCCESS) then
Ok = TRUE;
while(Ok = TRUE)
nChars = 50;
nResult = MsiViewFetch(phView, phResultRecord);
if(nResult = ERROR_SUCCESS) then
nResult = MsiRecordGetString(phResultRecord, 1, sFeature, nChars);
FeatureGetData(MEDIA, sFeature, FEATURE_FIELD_SELECTED, nReturn, sReturn);
if(nResult = ERROR_SUCCESS) then
if(nReturn = TRUE) then
ListAddString(lSFeature, sFeature, AFTER);
endif;
else
Ok = FALSE;
endif;
else
Ok = FALSE;
endif;
endwhile;
endif;
endif;
endif;
regards
Blueeberry
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 25, 2015
05:03 PM
Thanks to the post above here is my take on the code to work around the installshield bug that the FeatureListItems() does not work
export prototype FeatureListItemsEx(HWND, LIST, STRING);
// Extension method to retrieve the list of Child Features in the MEDIA (MSI) database
// as the InstallScript's FeatureListItems() does not work
function FeatureListItemsEx(hMSI, aChildFeaturesList, aParentFeatureName)
STRING childFeatureQuery;
STRING childFeatureName;
NUMBER result;
NUMBER bufferSize;
HWND hActiveDB;
HWND phView;
HWND phResultRecord;
begin
try
childFeatureQuery = "SELECT Feature FROM Feature WHERE Feature_Parent='" + aParentFeatureName + "'";
hActiveDB = MsiGetActiveDatabase(hMSI);
//Open/Create a view against the database using the query provided
result = MsiDatabaseOpenView(hActiveDB, childFeatureQuery, phView);
//Verify that the MSI database could be opened and the View created
if (result = ERROR_SUCCESS) then
//Execute the query/view
result = MsiViewExecute(phView, 0);
if (result = ERROR_SUCCESS) then
//Process the results of the query by looping through the records returned
while (MsiViewFetch(phView, phResultRecord) = ERROR_SUCCESS)
bufferSize = 255;
//Extract the first value (i.e. Feature "Name") from the record
result = MsiRecordGetString(phResultRecord, 1, childFeatureName, bufferSize);
if (result = ERROR_SUCCESS) then
ListAddString(aChildFeaturesList, childFeatureName, AFTER);
endif;
endwhile;
endif;
endif;
catch
MessageBox("Err.Description: '" + Err.Description + "'", INFORMATION);
endcatch;
end;
export prototype FeatureListItemsEx(HWND, LIST, STRING);
// Extension method to retrieve the list of Child Features in the MEDIA (MSI) database
// as the InstallScript's FeatureListItems() does not work
function FeatureListItemsEx(hMSI, aChildFeaturesList, aParentFeatureName)
STRING childFeatureQuery;
STRING childFeatureName;
NUMBER result;
NUMBER bufferSize;
HWND hActiveDB;
HWND phView;
HWND phResultRecord;
begin
try
childFeatureQuery = "SELECT Feature FROM Feature WHERE Feature_Parent='" + aParentFeatureName + "'";
hActiveDB = MsiGetActiveDatabase(hMSI);
//Open/Create a view against the database using the query provided
result = MsiDatabaseOpenView(hActiveDB, childFeatureQuery, phView);
//Verify that the MSI database could be opened and the View created
if (result = ERROR_SUCCESS) then
//Execute the query/view
result = MsiViewExecute(phView, 0);
if (result = ERROR_SUCCESS) then
//Process the results of the query by looping through the records returned
while (MsiViewFetch(phView, phResultRecord) = ERROR_SUCCESS)
bufferSize = 255;
//Extract the first value (i.e. Feature "Name") from the record
result = MsiRecordGetString(phResultRecord, 1, childFeatureName, bufferSize);
if (result = ERROR_SUCCESS) then
ListAddString(aChildFeaturesList, childFeatureName, AFTER);
endif;
endwhile;
endif;
endif;
catch
MessageBox("Err.Description: '" + Err.Description + "'", INFORMATION);
endcatch;
end;
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)