PDA

View Full Version : change Feature display name in runtime



hsong1
06-15-2005, 06:37 PM
hello

I want to use a Property inside a Feature Name. Example as follows:

Name: [ProductName]
Description: [ProductName] will be installed ...

at run-time, description works fine. however, in the custom dialog, the feature name shows "[ProductName]", rather than the actual property value.

i've done some research on this and find that feature's display name can be modified in the memory as follows:

{
MSIHANDLE hDB, hView, hRecord;

hDB = MsiGetActiveDatabase(hInstall);
MsiDatabaseOpenView(hDB,"SELECT * FROM Feature WHERE Feature =
'FeatureName'", &hView);

MsiViewExecute(hView, 0);
MsiViewFetch(hView, &hRecord);

MsiViewModify(hView, MSIMODIFY_DELETE, hRecord); // 6 = delete

MsiRecordSetString(hRecord, 3, "New Name");
MsiViewModify(hView, MSIMODIFY_INSERT_TEMPORARY, hRecord); // 7 = insert
temp

MsiViewClose(hView);
MsiCloseHandle(hRecord);
MsiCloseHandle(hView);
MsiCloseHandle(hDB);

return SUCCESS;
}

but this only works if that feature has no child feature.
how can i change parent feature's display name?? i've tried all the variation that i could think of but none of those works. (MSIMODIFY_UPDATE .. etc)

thank you