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

enable and disable features


4 replies to this topic

hsong3

hsong3
  • Members
  • 89 posts

Posted 30 September 2003 - 20:07

hello

I disable (not visible) features from my installation sequence in custom setup by using install script (code below). However, if i decided to go back and use original custom setup, the features are now shown.

(note that this feature includes subfeatures.)

to enable this feature again, I used same approach - except this time i tried MsiRecordSetString(hwRecord, 6, "1");
to install. but this is not working.

I even tried Addlocal and remove but the features are still visible (just not selected. that's all). MsiSetFeatureState is not working for me either.

i am totally lost here. what other option is there left??

thank you,

===========================================


hDatabase = MsiGetActiveDatabase(hMSI); //get handle for database

sQuery = "SELECT * FROM Feature WHERE Feature = '"+FeatName+"'"; //find scrollable text

MsiDatabaseOpenView(hDatabase, sQuery, hwView); //open database

MsiViewExecute(hwView, 0); //execute sql command
MsiViewFetch(hwView, hwRecord); //get output

MsiViewModify(hwView, MSIMODIFY_DELETE, hwRecord); //MSIMODIFY_DELETE = 6

MsiRecordSetString(hwRecord, 6, "0"); //change value in 6th column to install level

MsiViewModify(hwView,MSIMODIFY_INSERT_TEMPORARY,hwRecord); //MSIMODIFY_INSERT_TEMPORARY = 7

//closing handles
MsiViewClose(hwView);
MsiCloseHandle(hwRecord);
MsiCloseHandle(hwView);
MsiCloseHandle(hDatabase);

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 01 October 2003 - 05:36

I don't think you can modify the msi database of the running setup in this way (e.g. deleting permanent rows). In my experience this doesn't seems to work reliably, and I don't think you're supposed to do that. All you can do is insert temporary rows.

To change the install level of a feature why don't you use the Condition table?

trdavid

trdavid
  • Members
  • 3 posts

Posted 02 October 2003 - 08:49

Hi All,

Probably I don't know all tricks about MsiViewFetch-MSIMODIFY_DELETE
but bellow code works for me in run time (Windows 2000 SP4)

PMSIHANDLE hView = NULL;
PMSIHANDLE hRecord = NULL;

PMSIHANDLE hDB = MsiGetActiveDatabase(hInstall);

CString strSql =
_T("SELECT * FROM `ListBox` WHERE `Property`='") + strPropertyName + _T("'") ;

MsiDatabaseOpenView(hDB, strSq), &hView);

MsiViewExecute(hView, 0);

while (MsiViewFetch(hView, &hRecord)==ERROR_SUCCESS)
MsiViewModify(hView, MSIMODIFY_DELETE, hRecord);

MsiViewClose(hView);

Zweitze

Zweitze
  • Full Members
  • 522 posts

Posted 02 October 2003 - 09:09

The source with deleting and adding feature records looks OK to me, but... I don't think that changing the InstallLevel works after the Costing actions.
Try changing column 5 (Display) to hide/show the item, and MsiSetFeatureState to change the InstallState.

hsong3

hsong3
  • Members
  • 89 posts

Posted 02 October 2003 - 17:58

thank you for the replies,
it works now

^^